469,336 Members | 5,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Check is form is disposed

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
5 14392
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
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
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
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
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.

Similar topics

2 posts views Thread by Axel Foley | last post: by
3 posts views Thread by wj | last post: by
2 posts views Thread by Dknight | last post: by
2 posts views Thread by magister | last post: by
2 posts views Thread by Assimalyst | last post: by
7 posts views Thread by Boni | last post: by
1 post views Thread by Yammaski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.