C# comboBox1绑定数据集

来源:互联网 发布:网络修神txt全集下载 编辑:程序博客网 时间:2024/06/07 12:55
            this.comboBox1.DataSource = ds.Tables[0];
            this.comboBox1.ValueMember = "GUI";

            this.comboBox1.DisplayMember = "ZWM";


string userid = this.comboBox1.SelectedValue.ToString();这个是获取ID的代码

///

    ArrayList mylist = new ArrayList();
  mylist.Add (
new DictionaryEntry ("1",""));
  mylist.Add (
new DictionaryEntry ("2","不好"));
  mylist.Add (
new DictionaryEntry ("3","一般"));
  mylist.Add (
new DictionaryEntry ("4",""));
  mylist.Add (
new DictionaryEntry ("5","太好了"));
  comboBox1.DataSource 
=mylist; 
  comboBox1.DisplayMember 
="Key";
  comboBox1.ValueMember 
="Value"


0 0
原创粉丝点击