check whether a form is shown

ssfftt

Well-known member
Joined
Oct 27, 2005
Messages
163
Programming Experience
1-3
I have code to show a form: frmAAA.show

I want to have some code to check whether a form is shown. that is, to figure out whether frmAAA.show is executed.
Can anyone help on code plz?

e.g. to check a connection, we can have: if not connection.state = connected. but there is no "state" property for frmAAA, maybe something else?
 
thanx to jmcilhinney for this:
VB.NET:
 If myForm Is Nothing OrElse myForm.IsDisposed Then
           'A form has never been created or it has been destroyed, i.e. Closed.
  myForm = New Form
  myForm.Show()
Else
  'A form is already open.
  myForm.Activate()
End If
to use this, simply replace myForm with frmAAA
 
Back
Top