I am getting checkedListBox values from database. Based on my checkbox selection it will perform some operation.where i have to write the code for checked items.
+4
A:
You need to subscribe to the CheckListBox.ItemCheck
event. You can do this in code in your constructor or override to OnLoad
or you can use the WinForms designer properties window events tab.
In code (where checkListBox
is the name of your CheckListBox
):
public MyType()
{
this.checkListBox.ItemCheck += new ItemCheckEventHandler(OnCheckListBoxItemCheck);
}
private void OnCheckListBoxItemCheck(object sender, ItemCheckEventArgs args)
{
//TODO: Do your operation...
}
In the designer:
- Select your
CheckListBox
in the designer - Press Ctrl+F4 to view the Properties
- Select the Events tab (indicated by a little lightning bolt)
- Find the
ItemCheck
event and double-click - the event handler will be auto-generated and hooked up for you, you just need to add your code to make it do something
Jeff Yates
2010-06-25 13:59:43
+1
A:
Select the CheckedListBox in the designer, go to the Events tab in the Properties window, and double-click on any event.
SLaks
2010-06-25 14:00:34
if i have 3 item in the check box.based on the item i will do some operation so how can i check it value.because it will bind the data at run time.and the run time data changed every time
Ayyappan.Anbalagan
2010-06-26 06:02:29