|
-
Dec 2nd, 2005, 12:08 AM
#1
[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.
-
Dec 2nd, 2005, 12:31 AM
#2
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
-
Dec 2nd, 2005, 12:32 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|