How to check a CheckListBox item with one click?

I am coding a Windows Forms in C # and using CheckListBox Control.

How to check a CheckListBox with one click

+65
c # checkbox winforms
01 Oct '09 at 11:13
source share
4 answers

I think you are looking

CheckOnClick property

set to true

Gets or sets a value indicating whether the check box should be switched when an item is selected.

+145
01 Oct '09 at 11:15
source share
— -

Set the property in Design Time this way

enter image description here

or by code:

 CheckedListBox.CheckOnClick = true; 
+2
Feb 12 '18 at 11:40
source share

You can also check everything by clicking the button or click on the checklist

 private void checkedListBox1_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) checkedListBox1.SetItemChecked(i, true); } 
+1
Feb 13 '15 at 4:34
source share

I just finished working on the problem when I set CheckOnClick to True through the constructor, but the user interface still needed a second click to check the elements. I found that for some reason, the constructor file did not update when I changed the value. To solve, I went to the constructor file and added the line

 this.Product_Group_CheckedListBox.CheckOnClick = true; 

After that, everything worked as expected. Not sure why the designer did not update, but perhaps this workaround will help someone.

0
Feb 05 '19 at 14:54
source share



All Articles