How do i make my second groupbox in my panel visible and be able to use my controls in it while making the default groupbox and its control hidden?


Anku Kingsley

I have a panel with three groupboxes. Each groupbox has its control(combobox, labels, textboxes etc.). Groupbox1 is default when the panel is loaded. A combobox with two items determines when groupbox2 becomes visible while groupbox1 disappear so that the user can input certain information in it.

from properties, groupbox1: visible = "true" groupbox2: visible = "false" groupbox3: visible = "false"

My intention is that,

1) Item one does nothing when selected since default groupbox1 and its controls are already visible.

2) Item two makes groupbox1 and its controls hidden and groupbox2 and its controls visible. A combobox with similiar function is in groupbox2 exist to enable the switch back to the groupbox1 is item two is selected.

All this is supposed to occurs during runtime.

There is a third groupbox3 which is triggered by a button on the panel. I intend to make the groupbox3 visible whilst making everything on the panel look dim until a close button is clicked on groupbox3. i want to be able to make changes in the labels in groupbox1 and groupbox2 using a combobox control in groupbox3.

My Problem is

1) When i open the a new project and try the same code on a form it works but it does not work on my panel in my main application.

2)how do i make groupbox1 or groupbox2 on the panel appear faded and not totally hidden, while groupbox3 pops up like a messagebox,and also when i click a close button on groupbox3, groupbox3 closes while groupbox1 or groupbox2 becomes visible again.

private void panel1_Paint(object sender, PaintEventArgs e)


private void cb1_SelectedIndexChanged(object sender, EventArgs e)
gb1.Visible = cb1.SelectedIndex == 0;
gb2.Visible = cb1.SelectedIndex == 1;

switch (cb1.SelectedIndex)
case 0:
gb1.Visible = true;
gb2.Visible = false;
case 1:
gb2.Visible = true;
gb1.Visible = false;

private void bt1_Click(object sender, EventArgs e)

Continue reading...