MDI forms

  • Thread starter Thread starter JFB
  • Start date Start date
J

JFB

Hi All,
I have my MDI form and 10 child forms, I call the child form on the click
event from the menu using
Dim NewChildFrm As New newCustomerForm

NewChildFrm.MdiParent = Me

NewChildFrm.Show()

What can I prevent to open another newCustomerForm from the menu? if is
already one and open just got focus on the form.

Tks in advance

JFB
 
JFB said:
Hi All,
I have my MDI form and 10 child forms, I call the child form on the
click event from the menu using
Dim NewChildFrm As New newCustomerForm

NewChildFrm.MdiParent = Me

NewChildFrm.Show()

What can I prevent to open another newCustomerForm from the menu? if
is already one and open just got focus on the form.


http://groups.google.com/[email protected]
 
* "JFB said:
I have my MDI form and 10 child forms, I call the child form on the click
event from the menu using
Dim NewChildFrm As New newCustomerForm

NewChildFrm.MdiParent = Me

NewChildFrm.Show()

What can I prevent to open another newCustomerForm from the menu? if is
already one and open just got focus on the form.

\\\
Private myform As Form2

Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles Button1.Click
If myform Is Nothing Then
myform = New Form2()
'myform.MdiParent = Me
AddHandler myform.Closed, AddressOf Me.ChildForm_Closed
myform.Show()
Else
'MsgBox("Form already open: " & myform.Text)
Me.ActivateMdiChild(myform) ' Ungetestet: Evtl. funktioniert
' das nicht, da die Methode für die
' interne Infrastruktur dient.
End If
End Sub

Private Sub ChildForm_Closed( _
ByVal sender As Object, _
ByVal e As System.EventArgs _
) Handles MyBase.Closed
myform = Nothing
End Sub
///
 
Herfried,
I got an error...
Local variable 'NewChildFrm' cannot be referred to before it is declared.
But I already declare before...
Tks for you help
JFB
 
I fix this.. the problem now is that the form is created outside the MDI
form and it keeps creating a new one.
Tks
JFB

JFB said:
Herfried,
I got an error...
Local variable 'NewChildFrm' cannot be referred to before it is declared.
But I already declare before...
Tks for you help
JFB
 
Tks for you reply....
I have 10 child froms... can I make this sub's as general so I dont have to
create 20 sub's?
I'm new... Tks
JFB
 
Back
Top