CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    MenuItems - Unknowingly Handle Multiple OnClick Events

    I have about 15 MenuItems and i would like them all to use the same onclick event rather than multicasting a new event handler for each one.

    Is this possible? If so, how would my one event handler handle multiple possible object senders? Cast the sender to a MenuItem and act upon it?

    Thanks,
    -Mario

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: MenuItems - Unknowingly Handle Multiple OnClick Events

    That's what a Delegate is. Search it out here
    It's built in.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2003
    Location
    Bali, Indonesia
    Posts
    103

    Re: MenuItems - Unknowingly Handle Multiple OnClick Events

    This is a link that explain about event, delegate, and event handler.
    Hope this can help, its help me to understand about event.

    http://www.codeproject.com/csharp/ev...ndamentals.asp

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

Featured