Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Need Help with Panels
 

Need Help with Panels

Hi all,
       I have a Popup menu in my menu bar. I have two MenuItems there. If I select first one of them a panel should show up(this could be a form but I used panel). If I select the second one a different Panel should show up. What I did was create two panels and made them invisible. When I click the first MenuItem Panelone is displayed and its working fine. But when I click the second panel its not displaying the second panel.  My code is like this

protected void displayPanel1()
{
panel2.Visible = false;
panel1.Visible = true; 

}

protected void displayPanel2()
{
panel1.Visible = false;
panel2.Visible = true;
}

One more thing is the two panels are pointed out to same location. can some one help me with this or suggest another way to achive this.

Thank you
Dcmovva
MigrationUser 1  Wednesday, July 09, 2003 3:02 PM
If your panels occupy the same space, leave them both visible and
try doing this:

protected void displayPanel1() 

panel1.BringToFront();


protected void displayPanel2() 

panel2.BringToFront(); 
}
MigrationUser 1  Wednesday, July 09, 2003 6:13 PM
Thank you for your reply. But I will have to hide them until I call them from my menu bar. 

Thank you
dcmovva
MigrationUser 1  Wednesday, July 09, 2003 8:08 PM
debug through it and make sure your code is getting executed as you're expecting it to, because that should work just fine.

also, i thought i'd throw out, if you have multiple controls you want to show and hide, i'd suggest looking at my <a href="http://www.windowsforms.net/ControlGallery/ControlDetail.aspx?Control=251&tabindex=9">ControlArray</a> Component to group controls and just call one line of code for each group.
MigrationUser 1  Thursday, July 10, 2003 12:55 PM

You can use google to search for other answers

Custom Search

More Threads

• Designer: Value does not fall within expected range
• Look and feel
• rotating controls
• Displaying DataGridViewColumn-derived classes in the ColumnType property of the Edit Columns dialog box
• Make a componenent with IComponent in a nested namespace
• Resizing user control
• Form CancelButton, AcceptButton problem
• Custom Report field in Windows Application
• Changing width of left side list in collection editor
• Chat component