Control events code keeps getting renamed

n3on

Member
Joined
Aug 29, 2005
Messages
5
Programming Experience
3-5
I started writing code for a control's events, then I deleted the control, and remade it. Now the events are not associated with the remade control (same name and everything). I am moving from vb6 to .net so this is all very new. I am sure it's somthing simple anyone got an answer for me? Thanks in advance.
 

n3on

Member
Joined
Aug 29, 2005
Messages
5
Programming Experience
3-5
Also, when ever I try to open the control by dbl clicking it, it opens it the with controls name and _1.. so winsock_1 instead of just plain old winsock. I can't find anything on this.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,717
Location
Sydney, Australia
Programming Experience
10+
When you create an event handler for an object using the IDE, it puts a "Handles" clause on the method declaration, which is what links the method to the object. If you delete that object, the "Handles" clause is removed, so the event handler just becomes a plain old procedure. If you then add a new object, there is no link between the procedure and the object unless you re-add the "Handles" clause. If you try to use the IDE to create an event handler automatically, because a method with the default name already exists, a new method is created with the name changed slightly. The IDE does not assume that you want the existing method to be used as the event handler.
 
Top Bottom