Results 1 to 5 of 5

Thread: [RESOLVED] CheckBox [] problem

  1. #1

    Thread Starter
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Resolved [RESOLVED] CheckBox [] problem

    here is my problem, i create 5 CheckBoxes at the runtime
    and i added a new EventHandler for CheckStateChanged the problem is when i click on the checkbox there is nothing to identify this one only
    is there is any possible way to process the EventHandeler only on the checkbox only that i clicked
    thanks alot
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: CheckBox [] problem

    Every event handler has a 'sender' argument. The sender is always a reference to the object that raised the event. In your event handler do this:
    C# Code:
    1. CheckBox cbx = sender as CheckBox;
    2.  
    3. if (cbx != null)
    4. {
    5.     // Use cbx here.
    6. }
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: CheckBox [] problem

    well, thanks alot jmcilhinney
    it is woking fine

    i have another question if you can help
    i wanna remove a cotrol on a form i try but you know
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] CheckBox [] problem

    Please ask unrelated questions in separate threads. One thread per topic and one topic per thread.

    To add a control to a container, e.g. a Form, you call the Add method of the container's Controls collection, e.g. Me.Controls.Add. To remove a control from a container you would...

    Make sure you dispose the control also if you're finished with it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: [RESOLVED] CheckBox [] problem

    k thanks alot
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

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