can i use the same frame to display multiple forms?
What I would like to do is setup a menu system, so for the main form you will have a top navigation linking to different forms, but instead of loading a new form, I would like it if all info from that form would display in a frame, is this possible?
So if I have 3 button on my main page, button 1 links to form2, button 2 links to form 3, button 3 links to form 4 etc, so if I click button 1 form 2 will be displayed in the frame and so on.
Re: can i use the same frame to display multiple forms?
Do you want to show more than one form in the frame at the same time?
Re: can i use the same frame to display multiple forms?
Could you copy and paste the controls/code from the other forms onto 3 different pictureboxes on the main form, then when the buttons are clicked just set the visible property of the picturebox to true to show it.
Re: can i use the same frame to display multiple forms?
Quote:
Originally Posted by MartinLiss
Do you want to show more than one form in the frame at the same time?
no just one form at one time
Re: can i use the same frame to display multiple forms?
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