I am wanting to access a large number of forms from within a 'parent' form like in Access. There is a control that I have used that can load a form into itself by passing it the handle of the desired form.
What are the API functions used to do this?
Printable View
I am wanting to access a large number of forms from within a 'parent' form like in Access. There is a control that I have used that can load a form into itself by passing it the handle of the desired form.
What are the API functions used to do this?
VB Code:
Private 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 Private Sub Form_Load() 'Replace the 'Form1' below with the name of the 'Parent' Form Dim r As Long r = SetParent(Me.hWnd, Form1.hWnd) End Sub
That works but now I'm having a few problems.
I'm placing form2 inside a picture box. Whenever the picture box is resized I want the sub form to resize in order to fill the picture box. If I set form2 to vbMaximized it stays the size it was when it was loaded. If I resize form2 durring run time it disapears the second it is resized.
I'm using this to implement an explorer style interface with the sub forms loadeding into the right pane.