Adding Activated / Deactivate Event Handlers via IDE

I'm using VS.NET 2003 with C# as my programming language.  When I create a form, I can add most event handlers for it by going to the "Properties" window and clicking the lightning bolt.  However, certain key event handlers don't show up (including "Activated" and "Deactivate").  When I use the Class Viewer I see that the events do exist and I can override OnActivated and OnDeactivate, but I want to add an event handler for Activated / Deactivate, not override the OnActivated / OnDeactivate methods.

Do you know how to add Activated / Deactive event handlers via the IDE so that I won't have to bother hand-coding the declaration and the code to register the method as an event handler?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add this code to InitializeComponent in the form.
this.Activated += new System.EventHandler(this.frmTest_Activated);
this.Deactivate += new System.EventHandler(this.frmTest_Deactivated);

Also add this functions to the form class
private void frmTest_Activated(object sender, System.EventArgs e)

private void frmTest_Deactivated(object sender, System.EventArgs e)
See if it works for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EgoreAuthor Commented:
That works fine (it's my current solution).  However, I was looking for a way to select the events from a list in the IDE and have them inserted in automatically like all of the events listed under the lightning bolt icon.

What version on .NET do you use. I can see both event's in my IDE.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

EgoreAuthor Commented:
According to the help screen, it's developer environment 2003.

Are you looking in a VB.Net or a C#.Net application?  There is a huge difference in how they allow you to add events (which is actually why I posted this in the C# forum, not the .NET forum).  In VB.Net all events are listed in the code window's drop-down list (just like in VB6), but in C# you have to click the lightning bolt icon on the Properties window and only some of the possible events are listed.
I'm looking in C#. In C# you add events in proprty window. IE: clik on lbolt and it will show you all available events
EgoreAuthor Commented:
Well crazily enough, you're right.  I'm working on a Pocket PC application and they're not listed in the event list, but I just tried creating a Windows application and they are listed.  Since this is such an obscure issue (only occurs when using the Compact Framework and C#) I doubt anyone will know the solution.

I'm giving you the points since you did mention the solution that I was already using, so its at least a valid way to solve the problem.

Thanks for looking into this!
There are many things in .NET that can be improved on ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.