惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - niuyy

博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 .net 中用到excel中,检索COM类工厂中的CLSID为{000 24500-0000-0000-C000-000000000046}的组件时失败 客户端获取传递的参数 SQL语句中,插入单引号、添加、删除字段 JS给RadioButtonList赋值 在SQL2000中不显示系统表及系统文件 Embed标签详解 可以拖动,关闭的DIV组合 获取计算机用户名 浏览器字体变小 学习小技巧 C# 读取文本文件 字符编码 ComboBox与其他控件的联动 在.net中应用事务 数据库索引应用(ms-sql) 开发人员组要注意的网站 C# 在.cs文件中使用正则表达式
ComBox 绑定数据库
niuyy · 2008-03-14 · via 博客园 - niuyy

要求实现效果:
1:打开窗体时,ComBox .Text为空;
2:数据源来源于数据库;
3:下拉选项中,第一选项为空白

 1 public void BindCmb()
 2        {
 3            System.Data.DataTable dt = myData.GetMotorType().Tables[0];
 4            System.Data.DataRow row = dt.NewRow();
 5            row["ID"= 0;
 6            row["类型"= "";
 7            dt.Rows.InsertAt(row, 0);
 8            this.CmbDeviceType.DataSource = dt;
 9            this.CmbDeviceType.DisplayMember = "类型";
10            this.CmbDeviceType.ValueMember = "ID";
11            this.CmbDeviceType.SelectedIndex = -1;
12}

即在数据源(DataTable增加一空行)。

posted on 2008-03-14 11:43  niuyy  阅读(6853)  评论(0)    收藏  举报