Verify if Form is already open

  • Thread starter Thread starter nTn
  • Start date Start date
N

nTn

Hi!

I open a new form in my Mdi. But if I click in button again to open this
form, the program create another form.

How I can check if the form is already open?

I'm using that:

Dim frmUsuarios As New usuarios("Usuarios", Me)frmUsuarios.Show()
 
Use a shared function to open the form as a singleton then it will only be
created once.





..
 
Class Form1

Private Shared _Form As Form1

Auto Generated code ......

Public Shared Function SingltonShowForm(ByVal Title As String, ByVal Owner
As Object) As Form1

If _Form Is Nothing OrElse _Form.IsDisposed Then

_Form = New Form1

With _Form

..Text = Title

..Owner = Owner

End With

End If

_Form.Show()

Return _Form

End Function
 
Back
Top