http://www.cnblogs.com/JuneZhang/archive/2011/12/13/2286872.html
C#遍历ComboBox的内容:
一:
for (int i = 0; i < comboBox1.Items.Count; i++) { MessageBox.Show(comboBox1.GetItemText(comboBox1.Items[i])); }
二:
foreach (System.Data.DataRowView dr in comboBox1.Items) { string id = dr["student_id"].ToString(); string nane = dr["student_name"].ToString(); } //for (int i = 0; i < comboBox1.Items.Count; i++) //{ // DataRowView dr = (DataRowView)comboBox1.Items[i]; // string id = dr["student_id"].ToString(); // string nane = dr["student_name"].ToString(); //}
三:
for (int i = 0; i < comboBox1.Items.Count; i++) { comboBox1.SelectedIndex = i; string value = comboBox1.SelectedValue.ToString(); }