Solved

Event Names Keep Changing

Posted on 2008-10-06
7
210 Views
Last Modified: 2013-12-17
Sometimes randomly buttons will stop working, and it turns out that its because the event method name has changed.  For example:
private void button1_Click(object sender, EventArgs e)
to
private void button1_Click_1(object sender, EventArgs e)

Is there anyway to stop this from happening?  OR to easily change the code when it does?  As currently I have to cut all code from the original button click event to the new one.
0
Comment
Question by:angus_young_acdc
  • 3
  • 2
  • 2
7 Comments
 
LVL 13

Accepted Solution

by:
SameerJagdale earned 500 total points
Comment Utility
in design view, you get the events information in properties grid (watch the lightning bolt) select the appropriate event (in your case it is click), then from drop down select the event you wish to subscribe.
Does it make sense?
0
 
LVL 15

Author Comment

by:angus_young_acdc
Comment Utility
Hi yes I understand, its just rather annoying to have to do that for each individual control.  So I was hoping for a simpler solution if there  was one.
0
 
LVL 13

Expert Comment

by:SameerJagdale
Comment Utility
you can do the changes in initializecomponent directly.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
"Sometimes randomly buttons will stop working, and it turns out that its because the event method name has changed"

This isn't a "random" event...this happens when you CUT and PASTE a control from one place to another.  When you Cut the control the handler is automatically removed.  Then when you Paste it again and and rewire it...the IDE sees that there is already an existing method with the name it wants (from the previous stub handler) and so it creates a new method stub by adding the number after it.

0
 
LVL 15

Author Comment

by:angus_young_acdc
Comment Utility
I know that it happens when you cut/paste controls, however I have not been doing that which is why I see it as randomly changing.  They are not even being moved anywhere (and there is no panel to be their parent).
0
 
LVL 15

Author Comment

by:angus_young_acdc
Comment Utility
Can anybody help solve this?
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
We already listed the common cause of this and you said that wasn't it...not sure what else to suggest!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now