link events to subs for controls created At Runtime

Hello People

If I create a new control on my form during runtime, how can I set the new control's events?  For example, I create "btnNewButton1",  How can I add a "btnNewCutton1_Click" event? Keeping in mind, program is compiled and running!

Would it be possible to define a new class of buttons, and set it's _Click event so that a new control based on that new class would allready have it's _click event defined???  How would I do that??

Am I making sense???

Thanks.

-Pauli



pjlandryAsked:
Who is Participating?
 
Bob LearnedCommented:
AddHandler btnNewButton1.Click, AddressOf btnNewButton1_Click

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.