By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

Dumb IDE Question - Inserting an Event Handler

P: n/a
With the rich IDE on VB.net 2003, I was wondering if there is an easy way to
set the event handler function for a hand-coded object (SqlConnection for
example). I know that if I dim it withevents I can use the drop-down to
insert the event-handler template. But if I am not using the withevents, but
instead wiring things with the addhandler command, is there a way to get the
template inserted? Right now I am putting a 'dim withevents ..... as new
.....' just so I can get the event handler function template and then
deleting the 'dim withevents .... '

Just curious.

TIA

Marcus
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
After the object is set you can use "AddHandler" to handle the object's
events rather then dim withevents
"Marcus Smaby" <mr*****@msn.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
With the rich IDE on VB.net 2003, I was wondering if there is an easy way to set the event handler function for a hand-coded object (SqlConnection for
example). I know that if I dim it withevents I can use the drop-down to
insert the event-handler template. But if I am not using the withevents, but instead wiring things with the addhandler command, is there a way to get the template inserted? Right now I am putting a 'dim withevents ..... as new
....' just so I can get the event handler function template and then
deleting the 'dim withevents .... '

Just curious.

TIA

Marcus

Jul 19 '05 #2

P: n/a
Hello Marcus,

As you know (also suggested by Mike), the Handles/WithEvents keyword and
the AddHandler statement are two common methods to create an event handler.
Based on my experience and research, I did not aware thre is other easier
way.

In the meantime, I believe the following KB article is helpful:
Writing Event Handlers
http://msdn.microsoft.com/library/de...us/vbcn7/html/
vaconwritingeventhandlers.asp

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! C www.microsoft.com/security
This posting is provided as is with no warranties and confers no rights.

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.