Cut and paste Button gives new Click event

J Trahair

Well-known member
Joined
May 14, 2008
Messages
175
Location
Spain
Programming Experience
10+
Hi all. I am in development mode VB 2005 Pro in WinXP, I have a command button called Button2, with some code in the Click event. I Cut the button and immediately Paste it onto a Group (ie. Frame) on the same form. The Button2 properties still say Name = Button2. I double click the button expecting to view the Click event code, but it opens a new Click event called
HTML:
Button2_Click_1
which is empty. The last bit of the new Click event ends with
HTML:
Handles Button2.Click

How can I persuade the button Click event to remain as Button2_Click(ByVal etc.?

Thanks in advance.

By the way:
Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP2
Installed Edition: Professional
 
Drag it onto the other container instead of cutting it.

When you cut it the field is removed from Designer code and any Handles for it is also removed. It is possible to reassign the event handler by selecting it in the Properties window.
 
Back
Top