link events to subs for controls created At Runtime

Posted on 2006-03-24
Last Modified: 2010-04-23
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???



Question by:pjlandry
    1 Comment
    LVL 96

    Accepted Solution

    AddHandler btnNewButton1.Click, AddressOf btnNewButton1_Click


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now