1 Dictionary<string, string>test = new Dictionary<string, string>(); 2 test.Add("1", "第一行"); 3 test.Add("2", "第二行"); 4 test.Add("3", "第三行"); 5 comboBox1.DataSource = new BindingSource(test, null); 6 comboBox1.DisplayMember = "Value"; 7 comboBox1.ValueMember = "Key"; 8 9 10 string value = ((KeyValuePair<string, string>)comboBox1.SelectedItem).Value;
记性不好,方便检索
C# ComboBox基本使用,布布扣,bubuko.com
原文:http://www.cnblogs.com/aisiyes/p/3741722.html