用DataTable可以!但是总不能象男,女这样两项也用一个DataTable吧, 这也太麻烦了啊!
用Hashtable,SortedList直接添加键值对都报错了!
经过我多方的考究,最后终于搞定了,就用ArrayList就可以了!
用Hashtable,SortedList直接添加键值对都报错了!
经过我多方的考究,最后终于搞定了,就用ArrayList就可以了!
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 ="Value";
comboBox1.ValueMember ="Key";
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 ="Value";
comboBox1.ValueMember ="Key";