如何从选中的列表框中获取选中的项目 [英] how to get checked items from checked list box
本文介绍了如何从选中的列表框中获取选中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我有一个表格,其中有两个组合框和一个选中的列表框
c1,c2和check1
c1有10个项目
c2有7个项目
check1有20个项目
现在我要从c1和c2中选择项目以及从check1到sql server中的检查项目
但我不知道如何将选中的项目与选择的项目相关联
我已经做到这里了,但是下一步该怎么做
hi!
i have a form in which i have two combobox and a checked list box
c1, c2 and check1
c1 has 10 items
c2 has 7 items
check1 has 20 items
now i hav to select items from c1 and c2 and the check items from check1 to sql server
but i dont get how to relate the checked items with commbo box selected items
i have done till here but what to do further
for (int i = 0; i < comboBoxSelectModuleMRF.Items.Count; i++)
{
for (int j = 0; j < comboBoxSelectRoleMRF.Items.Count; j++)
{
if (comboBoxSelectModuleMRF.SelectedIndex == i && comboBoxSelectRoleMRF.SelectedIndex == j)
{
string modulename = comboBoxSelectModuleMRF.SelectedItem.ToString();
string rolename = comboBoxSelectRoleMRF.SelectedItem.ToString();
}
}
}
您能帮我下一步做什么吗?
can you help me what to do next
推荐答案
您必须全部选择它们,还是必须全部选择?循环检查不变的值是没有意义的.如果有一个选定的索引,则您知道该值,则无需循环查找它.
You have to select them all, or in sets ? Looping to check values that don''t change makes no sense. If there''s one selected index, then you know the value, you don''t need to loop to find it.
这篇关于如何从选中的列表框中获取选中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文