|
-
Aug 11th, 2010, 07:32 AM
#1
Thread Starter
Frenzied Member
[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
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);
}
}
}
}
-
Aug 11th, 2010, 08:37 AM
#2
Thread Starter
Frenzied Member
Re: CheckedListBox ItemCheck EventArgs
Should be
Code:
private void chklstboxReportNames_ItemCheck(object sender, ItemCheckEventArgs e)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|