Dumb IDE Question - Inserting an Event Handler

  • Thread starter Thread starter Marcus Smaby
  • Start date Start date
M

Marcus Smaby

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
 
After the object is set you can use "AddHandler" to handle the object's
events rather then dim withevents
 
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/default.asp?url=/library/en-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.
 
Back
Top