To programmatically dock a pane, you will need to destroy the pane, then create a new pane, using the CreatePane method to specify the new place to dock the pane.
The instance of the attached form\object still exists after a pane is destroyed. After you re-create the pane in the desired location you will then attach the form\object that was previously attached to the old pane to the new pane. If you set up the Attach_Pane event properly you should not have to worry about re-attaching the form\object to the pane.
The sample code below simply shows how to dock an existing pane to the right side of the application. Please download the sample project for the entire source.
'Dock the pane with Id ID_SEARCH_PANE to the right of 'the application MoveSearchPane ID_SEARCH_PANE, 200, 200, _ DockingDirection.DockRightOf 'subroutine used to dock a pane to the top, bottom, left, or right 'side of an application Private Sub MoveSearchPane(PANE_TO_MOVE As Integer, nWidth As _ Integer, nHeight As Integer, _ Optional Direction = DockingDirection.DockLeftOf) Dim Pane As Pane Dim sTitle As String Dim iIconId As Integer 'search for a pane with Id PANE_TO_MOVE Set Pane = DockingPaneManager.FindPane(PANE_TO_MOVE) 'If a pane with Id PANE_TO_MOVE exists save the Title and 'IconId, then destroy it If Not Pane Is Nothing Then 'save Title sTitle = Pane.Title 'save IconId iIconId = Pane.IconId 'Destroy Pane with Id PANE_TO_MOVE. ' 'NOTE: The instance of the attached form\object still 'exists and is not deleted, only the pane DockingPaneManager.DestroyPane Pane End If 'Creates new pane docking it in the new location, when the 'attach_pane event is called (which is the first time the 'pane becomes visible) the old form\object will get attached 'to the new pane Set Pane = DockingPaneManager.CreatePane(PANE_TO_MOVE, _ nWidth, nHeight, Direction, Nothing) 'Restore Title and IconId Pane.Title = sTitle Pane.IconId = iIconId End Sub