Raising Events from a class library

Posted on 2009-04-27
Last Modified: 2013-12-17
I am in a scenario where I have made a class library (*.dll) file.
At some point I need to raise an event( from within a class of the *.dll library) of a class(Like Event in the Class shown Below) which is outside or out of the scope of the *.dll library. How do I do it?
Do I need to add interface in that particular class of the *.dll library and implement in the calling class or any technique?
Does anybody have some idea?

Public Class SomeClass

         Public Event SomeEvent

End Class
Question by:biplavo
    LVL 18

    Expert Comment

    In order to call SomeEvent, you would need to have a reference to an object of SomeClass type, or to create a new one.


    Author Comment

    I didnot understand quite precisely.
    Could you please illustrate withan  example ?
    LVL 9

    Accepted Solution

    In you form where you will call it do this:
    'Form_Load event
    Dim sc As New SomeClass
    AddHandler sc., AddressOf
    'make a sub named the same as
    Private Sub
       ' do stuff
    End Sub
    LVL 18

    Expert Comment

    Yes, that was what I meant. You should call it the same way as you call button click event. If this class is in external dll, add reference to this dll first.
    LVL 9

    Expert Comment

    I answered the question completely and correctly. Shouldn't I get some points?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    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…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 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

    12 Experts available now in Live!

    Get 1:1 Help Now