3

在vs2010中怎样在combobox中绑定数据

 3 years ago
source link: https://blog.csdn.net/dmk877/article/details/23751309
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在vs2010中怎样在combobox中绑定数据

奋斗之路 2014-04-15 12:37:45 2504
分类专栏: .NET学习

C#高手群欢迎您的加入:207364916

SqlConnection Conn=.... string Sql= "select userid   from admin"; DataSet Ds= new DataSet(); SqlDataAdapter Da= new SqlDataAdapter(Sql, Conn); Da.Fill(Ds, "admin"); comboBox1.DataSource = Ds.Tables["admin"];

//选中一列绑定到combobox中 comboBox1.DisplayMember = "userid";

VB.Net开发一个小程序时候,用到一个显示多列的ComboBox,而且从数据取出来的数据表要绑定到一个ComboBox。找来找去,找不到。上Baidu Google很多人说:在VB.NetComboBox只能绑定一列数据。以前的VBA和VB的ComBox可以显示多列数据的。上.Net的怎么不可以能。自己考虑到可以用一个ComboBox和一个ListView结合做一个能够显示多列内容的ComboBox下拉框,可以将一个数据绑定ComboBox的用户控件。 界面和用法:http://blog.csdn.net/linjimu/archive/2009/01/09/3739537.aspx

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK