Reputation: 3
I have a strange issue. After I publish my project and got back to solution again I found out my code dosent' work and when I get on code of some buttons I found methods like that.
private void btnSave_Click_1(object sender, EventArgs e)
{
//empty area and there is same method without number 1 But it have my code
}
private void btnSave_Click(object sender, EventArgs e)
{
//my code
}
first: why does it happen ? Second : how can i solve it without copy and past ?
Upvotes: 0
Views: 228
Reputation: 1410
It seems like your button lots the connection to the Click
handle btnSave_Click
if you now double click your button in designer, it generates a new handler. Because btnSave_Click
already exists, it creates btnSave_Click_1
.
You can fix it by selecting your button in Designer, switch to the event tab, find the Click
event and select in the dopdown next to it the method btnSave_Click
After this, you can delete the btnSave_Click_1
method from your code.
Upvotes: 2