In a Winform I have a groupbox and in it several Textbox controls. If I delete the Groupbox the Textboxes get deleted as well. They are somehow tied to the Groupbox though I didn't do anything knowingly for this to happen. Question - how can I remove this connection, so that I can delete the groupbox and still have the textboxes on the form?
In the Designer.cs file you'll have a series of lines of code like :
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox1);
change them to say :
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this will make their container the form rather than the groupbox, and you can delete the groupbox after that. This will however move the textboxes, as their Position values are relative to their container which was the Groupbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With