-
-
文章搜索: 【点击打包该文章】
【本站开通在线QQ讨论群】
第一次做WinForm应用程序,居然发现 ComboBox 不能像DropDownList使用键值对,网上资料找得也幸苦,终于找到一种比较实用的方法:
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";
文章出处:http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/2008227/102010.html