* "JFB" <jf*****@directvinternet.com> scripsit:
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 K. Wagner [MVP]
<http://www.mvps.org/dotnet>