471,306 Members | 1,242 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

How to create event templates using vs.net 2003

hello,

I am trying to write code for form activate event and for an event of an
object.

Generally, you select the object/form from the top combo box in visual
studio ide, and select the event you want to code for from the right combo
box... which would generate a template ready to write code for the event.

I am not able to do this with vs.net 2003
The two top combo boxes in the IDE show only methods and objects that are
already there in the project.. how to get auto-generated template for new
events.

thanks
'Harish
Jan 19 '06 #1
1 1483

harish wrote:
hello,

I am trying to write code for form activate event and for an event of an
object.

Generally, you select the object/form from the top combo box in visual
studio ide, and select the event you want to code for from the right combo
box... which would generate a template ready to write code for the event.
Having all the available events listed in the top right combo is a
feature of the _VB(.NET)_ IDE, as far as I am aware.
I am not able to do this with vs.net 2003
The two top combo boxes in the IDE show only methods and objects that are
already there in the project.. how to get auto-generated template for new
events.


One way to do this in the C# IDE is in the docs under the topic title
'Hooking up to Events'; I reproduce some of it here:
In the Code Editor, IntelliSense can help you hook up methods (event
handlers) to event fields. See the Events Tutorial for more conceptual
information.

When you type the += operator after an event field, IntelliSense
prompts you with an option to press the TAB key. This inserts a new
instance of a delegate that points to the method that will handle the
event.

If you press TAB, then IntelliSense automatically completes the
statement for you and displays the event handler reference as selected
text in the Code Editor. To complete the automatic event hookup,
IntelliSense prompts you to press the TAB key again, to create an empty
stub for the event handler.

Note If your new delegate (created by IntelliSense) references an
existing event handler, then IntelliSense conveys this information in
the ToolTip. You can then modify this reference, as the text is already
selected in the Code Editor. Otherwise, automatic event hook up is
complete at this point.
If you press TAB, then IntelliSense stubs out a method with the correct
signature and places the cursor in the body of your event handler.

Note Use the Navigate Back command (CTRL+-) to go back to the event
hookup statement.


Note also that the automatic naming convention used by MS for event
handlers (objectname_eventname) is disapproved of by some people.

--
Larry Lard
Replies to group please

Jan 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by David Shorthouse | last post: by
8 posts views Thread by Mark | last post: by
3 posts views Thread by utterberg | last post: by
4 posts views Thread by Greg Merideth | last post: by
11 posts views Thread by Peter Oliphant | last post: by
1 post views Thread by Richard W | last post: by
1 post views Thread by rmunson8 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.