How associate different event handler at runtime
-
Hi Can anybody tell me how can I associate different event handlers for an array of controls that I have created dynamically. Suppose I create ten buttons at runtime. I want that every button perform differnt action e.g. give a message of such type. "You clicked" & (Button.Name) How this can be done. Thanks
reman
-
Hi Can anybody tell me how can I associate different event handlers for an array of controls that I have created dynamically. Suppose I create ten buttons at runtime. I want that every button perform differnt action e.g. give a message of such type. "You clicked" & (Button.Name) How this can be done. Thanks
reman
-
Hi Can anybody tell me how can I associate different event handlers for an array of controls that I have created dynamically. Suppose I create ten buttons at runtime. I want that every button perform differnt action e.g. give a message of such type. "You clicked" & (Button.Name) How this can be done. Thanks
reman
Adding to what kubben said, you can use the same handler for all buttons, then inside that handler use the first argument "sender", cast it to Button and you can read the button's name, or whatever you want to access. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google