I have a custom built combo box check box. I have taken it from http://www.codeproject.com/KB/combobox/extending_combobox.aspx
The drop down consists of 5 items, namely A, B, C, D, All.
What I wanna do is when the user checks All, uncheck A, B, C, D.
and when the user selects, either of A, B, C, D uncheck All.
I cannot figure out which logic should i put in.
I have tried this:
int index = ComboCheck.FindString(@"All");
foreach (var x in tComboCheck.CheckBoxItems.Where(y => y.Checked))
{
if(x.Text.StartsWith("A"))
{
ComboCheck.CheckBoxItems[index].Checked = false;
}
if(x.Text == @"All")
{
x.Checked = true;
}
}
It does not work. I am using this code under Checked Changed event. Please help
Simpler is better.
Ignore when users uncheck an item.
Don’t try to lump these into one loop statement, it just gets confusing that way.