C# winform中怎么用foreach遍历获得combox中的selectedindex啊?要能正确使用的!

如题所述

selectedindex只有一个值 怎么遍历~~~~~~~
selectedindex的意思是当前选中的这一项 的索引
如果你想遍历combox中所有的项
foreach(var item in combox.items)追问

我已经解决了
方法是
.遍历combox
foreach (System.Data.DataRowView dr in comboBox1.Items)
{
string id = dr["student_id"].ToString();
string nane = dr["student_name"].ToString();
}

温馨提示:内容为网友见解,仅供参考
第1个回答  2013-04-11
selectedindex 你知道他的含义么,这个是当前选中项的索引 选中几就是几 没法遍历
相似回答