Results 1 to 3 of 3

Thread: [RESOLVED] Dynamic events

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Resolved [RESOLVED] Dynamic events

    I have an arraylist that is read into my program from a file. The program then creates the Menu from those arraylist items.

    My question is, how can I tell when someone clicks on one of the menu items and how to get the text from it.

    EDIT: Nevermind, I got it. Was easy, lol








    Added [RESOLVED] to thread title - Hack
    Last edited by Hack; Dec 12th, 2005 at 10:30 AM.

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

    Re: Dynamic events

    You would need to write a method to handle the event first, i.e. at design time, then when you create the MenuItem at run time you should use the constructor that takes an event handler as the second argument. You would probably use the same event handler for every item and then in the event handler you would cast the sender argument as a MenuItem to access the Text property, etc.

    http://msdn.microsoft.com/library/de...ctorTopic3.asp
    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
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Dynamic events

    Thanks but I figured it out myself. I should try more before posting

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