I am just trying to set some panels on my form to adjust with the user expansion. THIs is all fine except for 2 panels that sometimes are not shown, then shown later. I basically have 5 panels docked at Top, Bottom, Sides, and middle. THe Left side panel at times must become invisible. THis is fine, the middle panel takes over and stretches. BUT, when I want the left panel to show again. I can't get it to dock again at the left side, it goes to the middle and the previous middle stays on the left....

THanks for any help....


Public Class Form1

Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


PanelLeft.Visible = False
PanelLeft.Dock = DockStyle.None

End Sub

Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

PanelMiddle.Visible = False
PanelMiddle.Dock = DockStyle.None


Dim a As Integer
a = PanelLeft.Width
Dim b As Integer
b = PanelMiddle.Width
PanelMiddle.Width = b - a ' want to shrink the enlarged middle back to size


PanelLeft.Location = New System.Drawing.Point(0, 41)
PanelLeft.Width = 180
PanelLeft.Dock = DockStyle.Right
PanelLeft.Visible = True


PanelMiddle.Location = New System.Drawing.Point(184, 41)

PanelMiddle.Dock = DockStyle.Fill
PanelMiddle.Visible = True

End Sub
End Class