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

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

Who is Participating?
dkloeckConnect With a Mentor Commented:
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
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.