How can I turn on and off what is selected? I have a checked listbox I want
Index 0 = "All" and each of the other nodes to be a number. If the user
selects all I want to uncheck all the other items and visa versa.
Here is what I have on the checked event. I can not get this to compile.
Thanks
/// <summary>
/// Event fires when user checks Item
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lstIteration_ItemCheck(object sender,
System.Windows.Forms.ItemCheckEventArgs e)
{
if (e.Index == 0)
{
this.lstIteration.ItemCheck -= new
System.Windows.Forms.ItemCheckEventHandler(this.ls tIteration_ItemCheck);
this.lstIteration.ClearSelected();
this.lstIteration..Items[0].Checked =
System.Windows.Forms.CheckState.Checked; //Line fails on compile
this.lstIteration.ItemCheck += new
System.Windows.Forms.ItemCheckEventHandler(this.ls tIteration_ItemCheck);
}
else
{
this.lstIteration.ItemCheck -= new
System.Windows.Forms.ItemCheckEventHandler(this.ls tIteration_ItemCheck);
this.lstIteration.Items[0].Checked =
System.Windows.Forms.CheckState.Unchecked; //Line fails on compile
this.lstIteration.ItemCheck += new
System.Windows.Forms.ItemCheckEventHandler(this.ls tIteration_ItemCheck);
}
}