Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Event Names Keep Changing

Posted on 2008-10-06
7
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 13

Accepted Solution

by:
SameerJagdale earned 1500 total points
ID: 22648829
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
ID: 22649870
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
ID: 22649906
you can do the changes in initializecomponent directly.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 22650428
"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
ID: 22650580
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
ID: 22691248
Can anybody help solve this?
0
 
LVL 86

Expert Comment

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

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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