[2005] How to prevent multiple instances of the form
Hi to All!
What must I do in order for me to prevent multiple instances of the form?
This code still allows to have another instance of the form:
Code:
Dim frm As frmVolAgeWarranty
' If the instance still exists... (ie. it's Not Nothing)
If Not IsNothing(frm) Then
' and if it hasn't been disposed yet
If Not frm.IsDisposed Then
' then it must already be instantiated - maybe it's
' minimized or hidden behind other forms ?
frm = New frmVolAgeWarranty
frm.BringToFront() ' Optional
Else
' else it has already been disposed, so you can
' instantiate a new form and show it
frm = New frmVolAgeWarranty()
frm.Show()
End If
Else
' else the form = nothing, so you can safely
' instantiate a new form and show it
frm = New frmVolAgeWarranty()
frm.Show()
End If
Re: [2005] How to prevent multiple instances of the form