C # Designer: removing redundant code from Design.cs

I have a form in which there are several buttons, labels and other things, but the developer seems to remember the old elements of this form that were previously deleted.

In any case, you need to “update” the code of the form .Designer.cs to tell him which elements are currently in the form and which are not.

Cheers for help in advance;)

+5
source share
1 answer

If they are still in the constructor file after restarting VS and reopening the constructor, they have not been deleted yet. I saw several cases when people think that the variables are deleted, but what happens, they were moved from the visible area of ​​the form. Thus, they still exist, but they do not do anything interesting.

What you can do is close the constructor, carefully remove all the variables you want from the designer.cs file, recompile and reopen the constructor. Before doing this, I would make a backup of the file, although it can ruin you by doing this.

+4
source

All Articles