Overrides and Events basic question.

E

ECVerify.com

This should be a basic question.

In VB.NET in the two drop downs over the source code for a form you
can get a list of the events and overrides for that form. In VC++ in
the properties window you can get the events and overrides. But for
some reason I can not seem to find the list of events and overrides
for a C# form, if I do this. the Intelisense will show them but as for
being able to select it and have the IDE pop the function or override
in like it does in VB.NET and C++ I have not figured out yet.

Thanks, Ed,
 
J

Jon Skeet [C# MVP]

ECVerify.com said:
This should be a basic question.

In VB.NET in the two drop downs over the source code for a form you
can get a list of the events and overrides for that form. In VC++ in
the properties window you can get the events and overrides. But for
some reason I can not seem to find the list of events and overrides
for a C# form, if I do this. the Intelisense will show them but as for
being able to select it and have the IDE pop the function or override
in like it does in VB.NET and C++ I have not figured out yet.

If you go to the designer view, then the properties tab, there's an
event icon there.
 
W

William Ryan

In the proprties grid,click on the thing that looks like a Lightning bolt.
You'll see all fo the events there....just double click on one of them and
it'll add the declaration and handler shell, all you need to do is add the
code you want to execute when the event is raised.

HTH,

Bill
 
D

Daniel Pratt

Hi Ed,

ECVerify.com said:
This should be a basic question.

In VB.NET in the two drop downs over the source code for a form you
can get a list of the events and overrides for that form. In VC++ in
the properties window you can get the events and overrides. But for
some reason I can not seem to find the list of events and overrides
for a C# form, if I do this. the Intelisense will show them but as for
being able to select it and have the IDE pop the function or override
in like it does in VB.NET and C++ I have not figured out yet.

The C# IDE has the events tab ("lightning bolt" on the property tool
window), which is better than the drop-downs (IMO) for a few reasons. The
events tab allows you to:

1.) Auto-create an event handler procedure via double-click, or
2.) Type what you want the event handler method to be named, or
3.) Choose from a drop-down list of methods that can handle the
event.

#3 is great for using the same event handling procedure for multiple
controls.

To add an override stub:

1.) Go to Class View.
2.) Choose the base class/ base member you want to override.
3.) Opposite-click and choose Add -> Override from the menu.

If you have VS.NET 2003 there are some other options as well. To wire up
an event handler right from the code window, type "<reference name>.<event
name>+=". A tooltip will pop up telling you to press TAB to insert a new
event handler, TAB again to create the stub. To override a method, just type
"override" followed by SPACE. A list of methods you can override will
appear. Choose a method to create the stub.

Regards,
Dan
 
E

ECVerify.com

Daniel Pratt said:
Hi Ed,



The C# IDE has the events tab ("lightning bolt" on the property tool
window), which is better than the drop-downs (IMO) for a few reasons. The
events tab allows you to:

1.) Auto-create an event handler procedure via double-click, or
2.) Type what you want the event handler method to be named, or
3.) Choose from a drop-down list of methods that can handle the
event.

#3 is great for using the same event handling procedure for multiple
controls.

To add an override stub:

1.) Go to Class View.
2.) Choose the base class/ base member you want to override.
3.) Opposite-click and choose Add -> Override from the menu.

If you have VS.NET 2003 there are some other options as well. To wire up
an event handler right from the code window, type "<reference name>.<event
name>+=". A tooltip will pop up telling you to press TAB to insert a new
event handler, TAB again to create the stub. To override a method, just type
"override" followed by SPACE. A list of methods you can override will
appear. Choose a method to create the stub.

Regards,
Dan


Everyone, thanks....I found it in the class view, but did not notice
that the events were in the designer view with the lightining
bolt...yes the lightining bolt is nice, it is more like the C++
lighting bold I am already used to...thanks for the quick response and
thanks for the detailed response from Dan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top