Loading of different panels

flashkid10

Member
Joined
Dec 9, 2016
Messages
16
Programming Experience
Beginner
I am making a list manager andIi want to add in a details display on the side. the are many different datatypes being displayed on the main table and for each class of data, I want a different panel to show it's unique specific data. I know of the layering panel method, but I am always tweaking the display; so to move all the panels out and edit hen move them back in is rather annoying. is there a way to save a panel and load it in, kinda like different forms in where you tweak them in their own tab and load them in when necessary?
 
Firstly, there is never a need to move any Panels just to edit them. You can edit them all in place in the designer. Assuming that you have added multiple Panel controls to the form and set all their Size and Location properties to the same values, you can obviously only see one Panel at a time. Which one you can see depends on the z-order. There are a number of ways to change the z-order.

1. Right-click on the Panel you can see and select 'Send to Back'. This will push that Panel to the bottom of the stack and reveal the next one in the z-order. You can do that multiple times until the Panel you want is displayed.
2. Use the drop-down at the top of the Properties window to select the Panel you want. This will display a selection border for the Panel, even if the Panel itself is hidden behind another. Right-click that border and select 'Bring to Front'.
3. Open the Document Outline window from the View menu and then alter the z-order by either drag and drop or using the toolbar.

Option 3 is the best in my opinion and you may well find other uses for the Document Outline window.

That said, you might also choose to create user controls instead of using Panels. You can add a new user control to your project and design it in the same way you would a form but then use it in the same way you would any other control.
 
I assume that, without actually saying so, you mean accessing child controls of a user control. In that case, you have two options:

1. You can set the access level of the controls you add to 'public' and they can then be accessed from outside the user control. That's the simple option but it's dodgy.
2. Add pass-through members to your user control for each member of a child control you need to access. For instance, if you need to access the Text property of a nameTextBox control then do this:
public string NameText
{
    get
    {
        return nameTextBox.Text;
    }
    set
    {
        nameTextBox.Text = value;
    }
}
 
Back
Top Bottom