Geoff,
"Geoff Jones" <no********@email.com> schrieb:
Supposing a form has been created as follows:
Dim form1 As New Form
How can I check to see if the form has been closed i.e. by clicking on the
cross in the top right of the form.
I'm guessing here, but it has been closed, the variable form1 won't
"point" to anything. Can I use this to see if the form has been closed?
The variable will still point to the form's instance, but the instance might
be disposed.
If the form is shown modally:
\\\
Dim f As New FooForm()
f.ShowDialog()
MsgBox("The form has been closed!")
///
Otherwise:
\\\
Dim f As New FooForm()
f.Show()
..
..
..
If f.IsDisposed Then
MsgBox("The form has been closed!")
Else
MsgBox("Form still open!")
End If
///
In addition to that, you can use 'AddHandler' to add a handler to a form's
'Closed' event in order to be notified when a form closes.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>