Remove form button and remove code

Asked

Viewed 618 times

0

Good afternoon guys, how can I clear the code in the situation where, I put the buttons as a certain use, then we decided to take the buttons but the codes are there, ( the events click ) How can I remove the button and remove events and references without triggering the program ?

  • 1

    It’s not just deleting the event code?

  • I did it once and I went down, I don’t want to risk it again

  • 1

    There is no reason to go wrong, just remove the control and then the code.

  • Until then it worked without problems

  • That is Forms or Web? Search for events in code by name (Button1_click for example), because events can be logged in another location and give error if you remove only the method itself

  • Num WindowsForm, events are recorded in the archive .Designer.cs, if it is a WebForms old, in the method InitializeComponent, and so on, so it’s no use just removing from the code, you have to clean in these places as well

  • @Ricardopunctual is Windowsform

  • Then look for events in the file with the same name as the form with .Designer.cs, otherwise it will give error if you remove only from the file .cs

Show 3 more comments

1 answer

2

Probably the error should that after deletion: inserir a descrição da imagem aqui

This happens that when you click 2 times in control to create an event it links the event in Form1.Designer.Cs, so if you simply delete the event in the code it generates this error.

Solutions:

1º Removing from the available events listed in the Tools tab. inserir a descrição da imagem aqui

Moving right into Form1.Design.Cs inserir a descrição da imagem aqui

I hope I’ve helped!!!

  • I removed the button and the event too, is working here quiet

  • blz!!!! If it helped, click on the arrow indicating that the answer was useful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.