Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Panel is not visible

Tags:

c#

winforms

panel

I have a main menu and when I click one of the buttons the menu panel should hide and the clicked one should open. This works for one button, but for my second it doesn't. Well, it shows the panel I guess, but it is empty, even though I have something in the panel.

The code is pretty simple, so I don't see where the problem is

public Form1()
{
        InitializeComponent();
        menu_botStrip.Text = DateTime.Now.ToString("dd/mm/yyyy h:mm tt");
        panel_startMenu.Show();
        panel_informationService.Hide();
        panel_customerManagement.Hide();
}

private void btn_informationService_Click(object sender, EventArgs e)
{
    panel_startMenu.Hide();
    panel_informationService.Show();
}

    private void btn_customerManagement_Click(object sender, EventArgs e)
    {

        panel_startMenu.Hide();
        panel_customerManagement.Show();
    }
like image 227
loomie Avatar asked Nov 27 '22 14:11

loomie


1 Answers

Make sure that you did not put the second panel inside the first panel. If you dragged the panels from the toolbox, there is high probability of this.

To make sure, open the Document Outline window (View->Other Windows->Document Outline), and look at the relation between panels. Make sure that they are not contained in one another. They must be at the same level of nesting.

If it is like this:

Wrong

then select the inner panel and press the left arrow button above the window. Then it should look like:

Right

which is the correct one.

like image 147
Mohammad Dehghan Avatar answered Dec 07 '22 06:12

Mohammad Dehghan