Hi,
I'm having a problem with opening two forms at once; when I open 1 form using vbmodal, the other form opened at the same time cannot be accessed. How can I overcome this?
Thanks
Printable View
Hi,
I'm having a problem with opening two forms at once; when I open 1 form using vbmodal, the other form opened at the same time cannot be accessed. How can I overcome this?
Thanks
That is the usage of modal forms. If you make a form modal, any other form that belongs to the application can be accessed.
If you want to access two forms together, do not use vbModal.
Try to use MDI forms for accessing multiple forms.
I've never used an MDI Form and don't know what one is either.
Basically, I have three forms; one parent form, two child forms. What I want is that when the two child forms are opened from the parent form, the parent form becomes inaccessible (but still visible).
Thanks.
By the way: I already have the three forms created.
Assuming that you have 3 forms named Form1, Form2 and Form3. Lets say Form1 is the main form and has two buttons on it, Command1 and Command2.
Form1 Code;
VB Code:
Option Explicit Public m_bForm2Opened As Boolean Public m_bForm3Opened As Boolean Private Sub Command1_Click() If Not m_bForm2Opened Then Form2.Show End Sub Private Sub Command2_Click() If Not m_bForm3Opened Then Form3.Show End Sub Private Sub Form_Activate() If m_bForm2Opened And m_bForm3Opened Then Form2.SetFocus End Sub Private Sub Form_Load() m_bForm2Opened = False m_bForm3Opened = False End Sub
Form2 Code;
VB Code:
Private Sub Form_Load() Form1.m_bForm2Opened = True End Sub Private Sub Form_Unload(Cancel As Integer) Form1.m_bForm2Opened = False End Sub
and Form3 Code;
VB Code:
Private Sub Form_Load() Form1.m_bForm3Opened = True End Sub Private Sub Form_Unload(Cancel As Integer) Form1.m_bForm3Opened = False End Sub
About MDI Forms follow the Link
A MDI form is like MS Word. Each document is a MDI child that opens in the parent. You can have many children in the parent, but when the parent closes, the children should also.
Thanks all :)
You can, if you like, just set frmMain.Enabled = False when the two child forms are displayed.
I remember something like that. The children don't close automatically, or something like that?