Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Where have the events gone?

This is such a newbie question it's embarasing. However, I recently spoke with a couple of Microsoft guys at a .NET event, and they both said "no problem", fired up their laptops to show me, and found that they didn't know the answer either...

Back in VB6, when I wanted to add an event handler to a control, I'd double-click on it, select the event I wanted from the event drop-down, and hey-presto, I'd have my event handler template.

In .NET, I double-click the control, and I get an event handler for the default event, but there's no longer a drop down list of the event handlers available. Sure, I can get a drop down list if I edit the "handles" keyword, but choosing an event here doesn't build the correct template parameters (which do sometime differ from the default).

The only relaible way I've found for building events is to copy them out of the help and amend them. I can suffer this if I have to, but if I've missed something obvious, I'd like to know about it!

James

James Shields
Friday, September 20, 2002

hehe  2 Microsoft guys didn't know it??  Well... yes, you missed something obvious. In the top of your code window, you see 2 comboboxes. In the first one, you can select your object, then in the 2nd, all the events will appear! ;)

Etienne Charland
Friday, September 20, 2002

Ahhhhhh!

I've got it now. It seems you have to explicitly select the object from the left combo. In VB6 it would automatically jump to the object the current method referred to.

It's easy when you know how.

If you know where the documentation mentions this, I'd be interested in hearing about it.

Thanks,

James

James Shields
Friday, September 20, 2002

And in C# you attach event handlers on GUI things from the properties window - click the event (lightning) icon at the top of the properties window and then double-click the event (or select an existing event handler from the drop-down)....

Dunc
Friday, September 20, 2002

How do you do it in ASP.NET and C#? I can only see in the combos what's already there.

Thomas Eyde
Friday, September 20, 2002

Thomas - did I pre-empt your question? It's not done from the code editor in C# -- its done from the Properties window when you're in Design View.

Dunc
Friday, September 20, 2002

*  Recent Topics

*  Fog Creek Home