By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,138 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Check is form is disposed

P: n/a
Hi,

How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed the
form


Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
You have the IsDisposed property in 1.1 as well. However, the difference
here is that you will need a reference to the instance of the form unlike in
2.0 where you can just call the class name as you would do in VB 6.0.

However, I'm not sure if IsDisposed is the best way to determine whether a
form is closed or not. Its better to use the Closed event of the form within
which you can set some boolean indicating that the form has been closed.

for example:
Private bFormClosed as boolean = False

private sub Form1_Load(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Load
bFormClosed = False
end sub

private sub Form1_Closed(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Closed
bFormClosed = True
end sub

then check the bFormClosed variable to determine whether the form is closed
or not.

hope this helps..
Imran.

"rob willaar" <lw****@xs4all.nl> wrote in message
news:41***********************@news.xs4all.nl...
Hi,

How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed the
form

Nov 21 '05 #2

P: n/a
Hi Imran,

Tnx for your reply.

I don't seem to have a .IsDisposed property on a reference to a form in
framework 1.1
This app will have a lot of forms so i don't like to have globals
"Imran Koradia" <no****@microsoft.com> schreef in bericht
news:Oz**************@TK2MSFTNGP11.phx.gbl...
You have the IsDisposed property in 1.1 as well. However, the difference
here is that you will need a reference to the instance of the form unlike in 2.0 where you can just call the class name as you would do in VB 6.0.

However, I'm not sure if IsDisposed is the best way to determine whether a
form is closed or not. Its better to use the Closed event of the form within which you can set some boolean indicating that the form has been closed.

for example:
Private bFormClosed as boolean = False

private sub Form1_Load(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Load
bFormClosed = False
end sub

private sub Form1_Closed(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Closed
bFormClosed = True
end sub

then check the bFormClosed variable to determine whether the form is closed or not.

hope this helps..
Imran.

"rob willaar" <lw****@xs4all.nl> wrote in message
news:41***********************@news.xs4all.nl...
Hi,

How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed the form


Nov 21 '05 #3

P: n/a
IsDisposed is inherited from the Control Class.
Maybe something like this is what you need then:

If CType(oMyForm, Control).IsDisposed then
'do something
end if

hope this helps..
Imran.

"rob willaar" <lw****@xs4all.nl> wrote in message
news:41***********************@news.xs4all.nl...
Hi Imran,

Tnx for your reply.

I don't seem to have a .IsDisposed property on a reference to a form in
framework 1.1
This app will have a lot of forms so i don't like to have globals
"Imran Koradia" <no****@microsoft.com> schreef in bericht
news:Oz**************@TK2MSFTNGP11.phx.gbl...
You have the IsDisposed property in 1.1 as well. However, the difference
here is that you will need a reference to the instance of the form unlike
in
2.0 where you can just call the class name as you would do in VB 6.0.

However, I'm not sure if IsDisposed is the best way to determine whether a form is closed or not. Its better to use the Closed event of the form

within
which you can set some boolean indicating that the form has been closed.

for example:
Private bFormClosed as boolean = False

private sub Form1_Load(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Load
bFormClosed = False
end sub

private sub Form1_Closed(byval sender as System.Object, byval e as
System.EventArgs) _
Handles Form1.Closed
bFormClosed = True
end sub

then check the bFormClosed variable to determine whether the form is

closed
or not.

hope this helps..
Imran.

"rob willaar" <lw****@xs4all.nl> wrote in message
news:41***********************@news.xs4all.nl...
Hi,

How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed

the form



Nov 21 '05 #4

P: n/a
Rob,

I agree with Imran,

When a form is disposed means that it is been opened before.

Gives crazy program control in my opinion.

(By the way, a user does not close a form, that is done by your program)

Just my 2 cents

Cor
Nov 21 '05 #5

P: n/a
Tnx Imran,Cor

I will use the booleans. You are right!

"rob willaar" <lw****@xs4all.nl> schreef in bericht
news:41***********************@news.xs4all.nl...
Hi,

How can i check is a form is disposed in framework 1.1
In framework 2.0 i can check Form.IsDisposed to check if a user closed the
form

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.