Confine Form To Another Form

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add another form to your project.
'Insert the following code to your module:

Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal _
hWndNewParent As Long) As Long

'Insert the following code to your first form (named Form1):

Private Sub Form_Load()
Load Form2
Form2.Show
End Sub

'Insert the following code to your second form (named Form2):

Private Sub Form_Load()
'Replace the 'Form1' below with the name of the 'Parnt' Form
r = SetParent(Me.hWnd, Form1.hWnd)
End Sub

Go Back