Results 1 to 2 of 2

Thread: [RESOLVED] CheckedListBox ItemCheck EventArgs

  1. #1

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Resolved [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);
                        }
                    }
                }
            }

  2. #2

    Thread Starter
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    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
  •  



Click Here to Expand Forum to Full Width