- Back to Home »
- Windows Applications »
- CheckedListBox
Posted by :
Sudhir Chekuri
Monday, 15 February 2016
Multiple items will be listed in a single control in the form of checkboxes.
By default you can select an item by double click it. To select by one click change CheckOnClick property to true.
To add items in the design mode click on the smart tag(Play symbol at the top of the control). Click on edit items. Enter text of items one per line to create multiple items.
Default event: SelectedIndexChanged which is fired when user selects and item
By default you can select an item by double click it. To select by one click change CheckOnClick property to true.
To add items in the design mode click on the smart tag(Play symbol at the top of the control). Click on edit items. Enter text of items one per line to create multiple items.
Default event: SelectedIndexChanged which is fired when user selects and item
Example
to display all the selected items text on a message box
private void
checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (string item in checkedListBox1.CheckedItems)
{
s+= item.ToString();
}
MessageBox.Show(s);
}