[RESOLVED] CheckedListBox ItemCheck EventArgs
Hi,
I am trying to implement the code below but am having a couple of issues.
The event fires when the check box is checked and in debug I can hover over the e in the function header and see that EventArgs e has 3 values Index, NewValue and CurrentValue.
However when I try and programmaticaly access these values I get the error message on build
Quote:
Error 4 'System.EventArgs' does not contain a definition for 'NewValue' and no extension method 'NewValue' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?)
I am new to C# and hoping someone can help me find out what the problem is here.
Code:
private void chklstboxReportNames_ItemCheck(object sender, EventArgs e)
{
System.EventArgs item = e;
int itemindex = item.Index;
chklstboxReportNames.GetItem(item);
if (itemvalue == "Select All")
{
if (e.NewValue=="Checked")
{
for (int x = 0; x <= chklstboxReportNames.Items.Count - 1; x++)
{
chklstboxReportNames.SetItemChecked(x, true);
}
}
else
{
for (int x = 0; x <= chklstboxReportNames.Items.Count - 1; x++)
{
chklstboxReportNames.SetItemChecked(x, false);
}
}
}
}
Re: CheckedListBox ItemCheck EventArgs
Should be
Code:
private void chklstboxReportNames_ItemCheck(object sender, ItemCheckEventArgs e)