Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've made a C# application in Visual Studio 2013, some days ago, I accidentally desconnected the power of my computer, when I turned on it again, the Startup Repair window was shown, it did its work but when I just opened my c# project again and made a build, the app.config file, debugging file and the main .exe's and vshost.exe were removed.

So I started to make my project again(copying the ruined project's code to my new project, including the components) but some things do not work, such as ContextMenuStrips(they show but their toolStripItems are not doing anything), MenuStrips(same as CTXMENU), etc.

My question is: What is going wrong? I have all the correct Namespaces, the code isn't showing any error. Can someone help me please?

Thanks in Advance - CCB
Posted

1 solution

It's likely that event handlers are not bound anymore to your controls.

Select any toolstrip item, and in the properties panel, click on the event button : there you will see which handler is affected to events for the control. If, for example, for the Click event, there is nothing shown, then you have to reaffect the method handling the event.

I hope I've been precise enough. Let me know if I didn't.
 
Share this answer
 
Comments
ChrisCreateBoss 5-Mar-15 22:23pm    
Yes I understand! So when I click a toolStripItem, it creates a new event handler but instead of calling it "toolstripitem1_Click" it is naming it "toolstripitem1_Click_1, I'll have to make the new event handlers to all my non-working components I guess.
phil.o 5-Mar-15 22:38pm    
Yes, if you double click on it it will create a new event handler, with a postfixed number because there is already a method with the default name.

You need to switch to event view in the properties panel, and then select the existing handler in front of the Click event. You don't need to recreate the handlers, only to reaffect them.

Cheers.
ChrisCreateBoss 5-Mar-15 22:46pm    
Yes! Thanks! It's working perfect!
phil.o 5-Mar-15 22:53pm    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900