Subscribing to an event that i have available in a .DLL that i added to my win forms proj?

Posted on 2006-05-31
Last Modified: 2010-04-16
Hi there,

I got a dll which i have added as a reference to my project, at the moment i am able to launch methods and propertys etc... No probs..

like so:-

        dotNetExtLib.ConnectClass myObj;

        public Main()

            // subscribe to event

            myObj = new dotNetExtLib.ConnectClass();

            //now i can do myObj.Methodname .. and it works..

It also contains events.. How do i subscribe to the event?

and where should i put the subscribtions to the events Main????? or my form i.e. the constructor??

I presume i will have to write the Event manually as its not a control but a dll

Any ideas would be really helpful, little lost with windows forms :-)

Thanks in advance

Question by:ianinspain
    1 Comment
    LVL 10

    Accepted Solution

    private dotNetExtLib.ConnectClass myObj = new dotNetExtLib.ConnectClass();

    public yourConstructor()
            myObj.Connected += new EventHandler(myObj_Connected);
            // assuming the myObj.Connected event is of type "EventHandler"

    private void myObj_Connected(object sender, EventArgs e)
            // do whatever you want with e

    =) good luck

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    This video discusses moving either the default database or any database to a new volume.
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    745 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

    14 Experts available now in Live!

    Get 1:1 Help Now