Change the name of splitContainer1

Dotnet WinForm has a control called Split container.  It is a nice control for making forms scale properly when the user changes their sizes.

Now there is a bug in Vsnet that surfaces when you put split containers in each other and do not change their default names.  splitContainer1, splitContainer2 etc.

The remedy is easy: change the name as you create the split containers.

Update:
The bug reveals itself by stopping the designer from rendering the form; instead a text like “a control cannot be in itself” shows.
If that happens you are not totally screwed even though there is no clue to what to do.

Open the .designer file and remove a split control. I have no idea of how to find out which split control messed up. Just remove one. Open the graphical designer (possibly close and open). Repeat until you have a form like usual but the controls you have put on the split controls are gone. Don’t dispair, they are not gone – they are just not placed anywhere.

Drop a split control on the graphical designer. Add controls to it through myListbox.Controls.Add( myTextbox )…. If you do it properly – like adding the right controls to the correct new split control everything is like before. Except possibly event handlers om the split controls. At least you didn’t have to remake the whole form.

Tags: ,

Leave a Reply