[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

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 ...in 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

1 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now