LB said:
How may i do to know if a form is already open ??
In vb6, i use Forms but i don't know how to do this in vbnet.
Thank you!!!
I do this...
'Define the form on the main form so every other form can "see it"
Public Shared fHome As frmHome = Nothing
Then for the button click to open ur form.
In my case its an MDI app.
===
Private Sub tsbHome_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tsbHome.Click
' If the instance still exists... (ie. it's Not Nothing)
If Not IsNothing(fHome) Then
' and if it hasn't been disposed yet
If Not fHome.IsDisposed Then
' then it must already be instantiated - maybe it's
' minimized or hidden behind other forms ?
fHome.BringToFront() ' Optional
Else
' else it has already been disposed, so you can
' instantiate a new form and show it
fHome = New frmHome
fHome.MdiParent = Me
fHome.WindowState = FormWindowState.Maximized
fHome.Show()
End If
Else
' else the form = nothing, so you can safely
' instantiate a new form and show it
fHome = New frmHome
fHome.MdiParent = Me
fHome.WindowState = FormWindowState.Maximized
fHome.Show()
End If
End Sub