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

Why is handles on event missing?

P: n/a
I'm using a third part component in a certain app. The component has
methods and events. I noticed one particular event was not firing after a
while but it should have been. The problem was the "handles" part was
missing. I didn't remove this that I know of. After putting this back in,
the event started firing.

Actually, the code inside the event wasn't firing but the "private sub
eventname()" part was being hit. By putting a breakpoint there, I found the
handles part was missing.

How else could this have gone missing?

Thanks,
Brett
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Brett,

If you create a Sub for a particular control's event, let's say a button
click event, then subsequently delete the control, the sub for the click
event will remain, but since the control was deleted, the "Handles
Button.click" will be missing.

Once you add the control back to the form, even if you give it the same
name, you'll have to go back to each of the event subs for the control and
add the "handles control.event"

HTH
Lee

"Brett" <no@spam.net> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
I'm using a third part component in a certain app. The component has
methods and events. I noticed one particular event was not firing after a
while but it should have been. The problem was the "handles" part was
missing. I didn't remove this that I know of. After putting this back in,
the event started firing.

Actually, the code inside the event wasn't firing but the "private sub
eventname()" part was being hit. By putting a breakpoint there, I found
the handles part was missing.

How else could this have gone missing?

Thanks,
Brett

Nov 21 '05 #2

P: n/a
No exactly. If you then add a control after its been removed with the same
name & double-click it to get the click event up for example then you will
notice a number appended to the end. Example:

Button1_Click(...) Handles...

Button1_Click1(...) Handles...

well, at least that what it does on all my machines with VS.NET 2003 Ent.
Arch installed.

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3

P: n/a
I agree that if you remove a control, rebuild the project, and add a control
with the same name (say "Button"), if you double-click the control to add
the click event, the new sub name will have a 1 appended.

However, the original sub will be missing "Handles Button.Click", because
the project was rebuilt without a reference to the control named "Button".

For the click event, there are two choices to fix the missing "Handles".
Double-click on the new control to create a new click event sub, then
cut/paste the code from the original click event, then delete the original
click event, or just add the "Handles Button.Click" back to the original
sub.

For other subs related to the added control, you can recreate them,
cut/paste, etc., or just add the "Handles Control.Event".

But, in response to the original question asked, the "Handles" disappear if
a control is deleted from the form, and the project is re-built. Adding the
same control with the same name back to the form does not add the "Handles
Control.Event" back to any existing subs.

Cheers,
Lee

"Crouchie1998" <cr**********@spamcop.net> wrote in message
news:uo**************@TK2MSFTNGP12.phx.gbl...
No exactly. If you then add a control after its been removed with the same
name & double-click it to get the click event up for example then you will
notice a number appended to the end. Example:

Button1_Click(...) Handles...

Button1_Click1(...) Handles...

well, at least that what it does on all my machines with VS.NET 2003 Ent.
Arch installed.

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.