Hi Herifried,
Thanks for replying. I found the information in my previous post wasn't
enough to tell you the entire picture ... so I think I should tell you a
little bit more about what I'm trying to do.
There are two forms in my program - namely Form 1 and Form 2. A button in
Form 1 opens Form 2, where the user is prompted to enter some information.
After the information has been entered, Form 2 is closed and the data
collected in Form 2 is used for some process in Form 1.
I'd like to know how can Form 1 detect that Form 2 has closed and it can
carry on.
Thanks again.
Xero
"Herfried K. Wagner [MVP]" wrote:
"Xero" <jeff_@_chezjeff_._net(remove_underscores_and_this )> schrieb: How do you detect whether a form has been closed or not?
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/>