Hi. This is probably too easy, but... Can anyone tell me how to add or remove a checkbox from a panel by using the Designer? The only samples I could find online had the code nside an arbitrary method called CreateMyPanel().

I'm looking at a file called MyControl.Designer.cs, and inside InitializeComponent() I see the code:

this.panel1.Controls.Add(this.checkBox1);

Now I would like to remove it, but by using the Designer, since it's recommended not to manually modify the designer-generated file.

Can anyone tell me how to remove that checkbox from the panel through the Designer UI?

Thanks.

>Can anyone tell me how to remove that checkbox from the panel through the Designer UI?

Correct me if I'm wrong. When you dragged a "checkbox" in designer (view) mode outside that panel, code this.panel1.Controls.Add(this.checkBox1); will be removed automatically from the designer.cs.

commented: Not only knowledgeable, but quite modest, too... +1

That's it. Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.