Code:Option Explicit Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Private Sub Command1_Click() UnloadOtherForms Form2.Show SetParent Form2.hWnd, Frame1.hWnd End Sub Private Sub Command2_Click() UnloadOtherForms Form3.Show SetParent Form3.hWnd, Frame1.hWnd End Sub Public Sub UnloadOtherForms() Dim frm As Form For Each frm In Forms If frm.Name <> "Form1" Then Unload frm Set frm = Nothing End If Next End Sub




Reply With Quote