Add Event to the referenced form in

Posted on 2004-11-17
Last Modified: 2010-04-24
I have one form in the application(client) that has been referenced from the class library.  I like to add event like button_clicked on the referenced form.  How to add the events of forms and control of forms in the client application if the form is not added manually but is referenced from another class library.
Question by:tgatif
    1 Comment
    LVL 96

    Accepted Solution

    The easy way is to:

    (1) Define an event in the form:
         Public ButtonClickedEvent(sender As Object, e As EventArgs)

    (2) Raise the event:
         RaiseEvent ButtonClickedEvent(Me, New EventArgs)

    (3) Catch the event:
         Private WithEvents formReference as frmMain

        Private Sub formReference_ButtonClickedEvent(sender As Object, e As EventArgs)
        End Sub


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    729 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

    18 Experts available now in Live!

    Get 1:1 Help Now