Hi all
I am developing a form with a toggle button in the toolstrip ... i have given the property checkonclick to true and gave this coding in the click event....

I am loading a Groups (Usercontrol) in the MainPanel1 (panel)....
It works for first time but does not work again for the second time... am i doing any thing wrong or is there any other code for this....

Please help me...

int groupsPanel = 0;
Groups groups = new Groups();

 private void Group_toolStripButton_Click(object sender, EventArgs e)
        {
            if (groupsPanel == 0)
            {
                groupsPanel = 1;

                MainPanel1.Controls.Add(groups);
                groups.Dock = DockStyle.Left;
               
               
            }
            else if (groupsPanel == 1)
            {
                groupsPanel = 0;

                groups.Hide();
               
            }
        }

Thanks
vince

Seems like you are calling Hide() properly, but instead of calling Show() to show the control you are creating a new one. Instead, try calling groups.Show()

So simple it worked thanks....

Is there any way to close a panel instead of hiding it or making its visible false....

This question has already been answered. Start a new discussion instead.