I've never dealt with checkedListBox1 until now. A program that I want to make will benefit from using it rather than having to use numerous Checkboxes.
I have the code:
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int selected = checkedListBox1.SelectedIndex;
this.Text = checkedListBox1.Items[selected].ToString();
}
The problem with this is that each time I click on the box and it highlights, it then selects the highlighted object. What I am looking for is it to recognize a change in what has been selected, not highlighted.
What I'm also wanting to know is say if the first index item in CheckListBox is checked as well as the 3rd, how would I check to see if it is true or not?
I'm certain I will eventually figure it out but seeing the code would immensely help.
Say I have 3 boxes: Box A = messageBox.Show("a"); Box B = messageBox.Show("b"); Box C = messageBox.Show("c");
It will only display the mbox if the box is checked. What I want to know is how can I have it check to see if, for example, A and C is checked so that if I pressed a button, the two messageBoxes will display either "a" and then "c"
I think you should check it in MouseUp for whether the 1st is checked. and _ItemCheck is for when a checkbox is changing, but value not updated yet.
See reference: http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.items.aspx
If you want to get the collection of all checked items use checkedListBox1.CheckedItems. To display all checked items upon clicking a button, use following:
If you need only their indices, use checkedListBox1.CheckedIndices instead.