在CheckedListBox控件中需要帮助 [英] need help in CheckedListBox control

查看:62
本文介绍了在CheckedListBox控件中需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请告诉我如何在按钮上取消选中CheckedListBox的选中值



谢谢

Hi all

Please tell me how to uncheck the checked value of a CheckedListBox on a button click

thank you

推荐答案

取消选中所有选中的项目:

uncheck all of checked items:
chkitem.ClearSelected();





取消选中CheckedListBox的选中值:



Uncheck the checked value of a CheckedListBox:

chkitem.SetItemChecked(index, false);





您的代码:



And your code:

foreach (int index in chkitem.CheckedIndices)
{
    chkitem.SetItemChecked(index, false);
}


解决方案1:



您也可以尝试这样做。< br $>


Solution 1:

you can try like this also.

checkedListBox1.Items.Add("value1", CheckState.Unchecked);





为了更好地理解,请点击此链接。 CheckBoxList



解决方案-2 :



也可以这样试试。





For better understanding follow this link. CheckBoxList

Solution-2:

Try like this too.

foreach(int i in checkedListBox1.CheckedIndices)
{
    checkedListBox1.SetItemCheckState(i, CheckState.Unchecked);
}









谢谢





Thanks


本文将解决您的问题 -



http://vbcity.com/blogs/mike-mcintyre/archive/2010/06/15 /checkall-and-uncheckall-extension-methods-for-windows-forms-checkedlistbox-class.aspx [ ^ ]
This Article wil Solve Your problem-

http://vbcity.com/blogs/mike-mcintyre/archive/2010/06/15/checkall-and-uncheckall-extension-methods-for-windows-forms-checkedlistbox-class.aspx[^]


这篇关于在CheckedListBox控件中需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆