B
Bob
Hi everyone:
I am relatively new to VB.NET, but have used VB 6.0 for several years. I
have an MDI application with 3 forms. Form1 is the parent, and Form2 and
Form3 are the child. Can someone tell me how to open Form2 from Form1 and
Form3 from Form2 by clicking on command buttons?
Here is my code for Form1:
Dim childForm As Integer = 0
Dim childForms() As Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
childForm += 1
ReDim Preserve childForms(childForm)
childForms(childForm) = New Form2
childForms(childForm).Text = "ChildForm" & Str(childForm)
'setting title for child windows and incrementing the number with an
array
childForms(childForm).MdiParent = Me
childForms(childForm).Show()
End Sub
Here is the code for Form2:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim DumbForm3 As Form3
Dim DumbMDI As Form1
DumbForm3 = New Form3
DumbForm3.Text = "ChildForm DumbForm3"
DumbForm3.MdiParent = DumbMDI
DumbForm3.Show()
End Sub
When I run this, Form3 is not a child form. Thanks for your help.
Bob
I am relatively new to VB.NET, but have used VB 6.0 for several years. I
have an MDI application with 3 forms. Form1 is the parent, and Form2 and
Form3 are the child. Can someone tell me how to open Form2 from Form1 and
Form3 from Form2 by clicking on command buttons?
Here is my code for Form1:
Dim childForm As Integer = 0
Dim childForms() As Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
childForm += 1
ReDim Preserve childForms(childForm)
childForms(childForm) = New Form2
childForms(childForm).Text = "ChildForm" & Str(childForm)
'setting title for child windows and incrementing the number with an
array
childForms(childForm).MdiParent = Me
childForms(childForm).Show()
End Sub
Here is the code for Form2:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim DumbForm3 As Form3
Dim DumbMDI As Form1
DumbForm3 = New Form3
DumbForm3.Text = "ChildForm DumbForm3"
DumbForm3.MdiParent = DumbMDI
DumbForm3.Show()
End Sub
When I run this, Form3 is not a child form. Thanks for your help.
Bob