I copy/paste controls in the projects, then I noticed that there are many controls are listed in designer.vb which actually are not being used. how can I clean these? will it affect the UI performance? or, it does nto matter at all?
thanks
Printable View
I copy/paste controls in the projects, then I noticed that there are many controls are listed in designer.vb which actually are not being used. how can I clean these? will it affect the UI performance? or, it does nto matter at all?
thanks
If for some reason the designer.vb files lists controls that are no longer used or needed, then you can just delete all references to them in the designer file and rebuild your project. The file is nothing more than auto generated code that one could write themselves. It is not different in any way (with the exception that at any point the IDE could regenerate the file, so putting custom code in there is never a good idea)
designer.vb is autogenerated so I doubt there are some controls that are not used. Well, sometimes it gets messy.
Try clicking View/Other Windows/Document Outline
Default hotkey: CTRL+ALT+T
All controls will be displayed in hierarchical order. You can check whether there are unnecessary ones and delete them (or click and drag them along the tree).
thank you both.
yes, designer.vb is auto generated, however, when I copy/paste controls, especially tab, and then rename the controls later, it leaves many unused controls in the designer.vb. I did not notice this until I used the same form for different projects (which means I copied/pasted many times). so, lots of unused controls, :( it makes really difficult to remove the controls manually from the file. is there a feature that I can force VS rebuild it?
thanks again.
The only thing I can think of is if you did something like this:
1) highlight ALL the controls on the form (I assume whatever controls are actually visible on the form in the designer are controls you want to keep)
2) ctrl+c to cut all the controls off the form so it is now a blank form
3) go into the designer file, and all the code from the controls you wanted to keep will be gone, so now you can delete all the extra crap that is in there with regards to phantom controls.
4) go back to the blank form designer, and ctrl+v to paste the controls back to the form, which in turn will put their code back into the designer.vb file
The only downside to this approach is that it will remove any auto wired up event handlers in your code (any control that has an event handled with the Handles clause on a subroutine). You won't lose the code, just the handles clause on the end of the sub. You would have to add those back manually.