Crash893
Crash893

Reputation: 11712

How to raise an event between two different forms ( of the same program)

I have a MDI form that will open a logon form so the user can be authenticated

when the user hits the logon button and is properly authenticated i wanted to trigger an event that the parent form could pick up and change some variables ((authenticated = true) for example)

I understand how to do this in something like a textbox or a costume usercontrol but im not clear on how to do it between forms because i usually do it through the designer view

can someone walk me through triggering an event on a diffrent form?

Upvotes: 2

Views: 1200

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1503729

In the parent form, something like:

loginForm.Authenticated += MyEventHandler;

or

loginForm.Authenticated += delegate { /* Code here */ };

or

loginForm.Authenticated += (sender, args) => { /* Code here */ };

Upvotes: 2

Related Questions