473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

buttons stopped working

I did a cut & paste of some button controls on one of my forms and now
the button procedures don't get called when the buttons are pushed.
Somehow dotnet has disassociated the buttons with their previous code.

If I double-click the buttons in design mode, dotnet wants to create new
click procedures for them with names appended with _1 (example: Private
Sub ButtonQuit_Click_1)

The question is, how do I make the button procedures match the control
names again?

The properties sheets on the controls still show them by their original
names. If it matters, I pasted the controls onto the form after adding a
tab control.

Dotnet version is 2002 SP1

Thanks
Sep 19 '06 #1
3 1372
Dave Cullen wrote:
I did a cut & paste of some button controls on one of my forms and now
the button procedures don't get called when the buttons are pushed.
The "Handles" clauses get /dropped/ when you cut and paste controls
around. It's just something the IDE does.

You'll have to find each event handler in the code and add the Handles
clauses again.

Next time you feel the urge to move controls around like htis, add the
Tab Control and Tab Page to the form, save it, close the Designer and
open up the code Region that's marked "Do Not Change" .. and change it.

Look for the lines of code that add each Control to the Form:

Me.Controls.Add( Me.X )

If Me.X is one of the Controls that you want to move onto the Tab Page
(called, say, Me.Tab1), change the above line to

Me.Tab1.Controls.Add( X )

Save the Form, rebuild the project, cross your fingers and open the
Designer. With a /bit/ of luck, your controls will have moved onto the
tab page and will still have all their event handlers attached.

HTH,
Phill W.
Sep 19 '06 #2

"Dave Cullen" <no****@mail.comwrote in message
news:45***************@mail.com...
>I did a cut & paste of some button controls on one of my forms and now
the button procedures don't get called when the buttons are pushed.
Somehow dotnet has disassociated the buttons with their previous code.

If I double-click the buttons in design mode, dotnet wants to create new
click procedures for them with names appended with _1 (example: Private
Sub ButtonQuit_Click_1)

The question is, how do I make the button procedures match the control
names again?

The properties sheets on the controls still show them by their original
names. If it matters, I pasted the controls onto the form after adding a
tab control.

Dotnet version is 2002 SP1
If you look at the "Handles" keyword after the event handler declaration,
you will see that it is no longer associated with the control. Simply
re-insert the "Handles myControl.abc" to make it work again.

i.e.:

Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

becomes.........

Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As
System.EventArgs)

so, add the "Handles MyBase.Load" in this example.

Sep 19 '06 #3
You guys rock. Thanks very much.
Robinson wrote:
>
"Dave Cullen" <no****@mail.comwrote in message
news:45***************@mail.com...
I did a cut & paste of some button controls on one of my forms and now
the button procedures don't get called when the buttons are pushed.
Somehow dotnet has disassociated the buttons with their previous code.

If I double-click the buttons in design mode, dotnet wants to create new
click procedures for them with names appended with _1 (example: Private
Sub ButtonQuit_Click_1)

The question is, how do I make the button procedures match the control
names again?

The properties sheets on the controls still show them by their original
names. If it matters, I pasted the controls onto the form after adding a
tab control.

Dotnet version is 2002 SP1

If you look at the "Handles" keyword after the event handler declaration,
you will see that it is no longer associated with the control. Simply
re-insert the "Handles myControl.abc" to make it work again.

i.e.:

Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

becomes.........

Private Sub DataTreeView_Load(ByVal sender As Object, ByVal e As
System.EventArgs)

so, add the "Handles MyBase.Load" in this example.
Sep 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Niel | last post by:
Hello friends, I am not sure if i am posting to the correct group but if anyone has an idea about this and the possible solution or the link to that solution then please let me know We have out...
12
by: Beer | last post by:
Hello Everyone, We have been getting the EventID 7031 errors ever since we installed SP 3. We have been searching for any possible solution, but not much luck. We are running Windows 2000...
2
by: Dag Sunde | last post by:
I have the following code fragment in one of my pages: if (typeof document.getElementById('myApplet').getTableAsSDV != 'undefined') { rowBuffer =...
1
by: Darren D'Orlando | last post by:
I recently had a problem with my computer, the keyboard stopped working. I fixed that then I couldn't connect to the my IIS server, it no longer recognized my computer as a server...So I...
5
by: Vik | last post by:
All the buttons on all the aspx pages of a Web site stopped working. Why could this happen? Thank you.
0
by: Duncan Welch | last post by:
I have multiple projects that I've just converted into a single solution, by changing the namespaces then adding each project. After a fair amount of heartache, most of the projects are working...
10
by: Aussie Rules | last post by:
Hi, For some reason my App has stopped displaying buttons and other such controls with the XP style. They have all reverted back to the standard style button. I have the buttons.flatstyle...
1
by: rickcasey | last post by:
I wonder if anyone has experienced something like this, as it seems truly bizarre and is causing me to tear out my hair (what little there is left of it).... The exec() function just suddenly...
8
by: teddarr | last post by:
Last night while I was working on my project, all the buttons in my solution stopped working. I was moving the project from my local machine to my schools server. Does anyone know what I can do...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.