C# 怎样实现combobox 自动显示全部内容

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:10:47
先谢了!

给你写个示例吧,希望你能看懂。
ArrayList List=new ArrayList();
List.Add(new DictionaryEntry("全部", 0));
List.Add(new DictionaryEntry("男性", 1));
List.Add(new DictionaryEntry("女性", 2));
this.cboSex.DataSource = List;
this.cboSex.DisplayMember = "Key";
this.cboSex.ValueMember = "Value";
this.cboSex.SelectedValue = 0;
有兴趣你可以自己看下。

数据绑定啊

直接通过sqldatasource,向导式建立数据绑定

用.DataSource绑定数据源呀