PC Review


Reply
Thread Tools Rate Thread

Check is form is disposed

 
 
rob willaar
Guest
Posts: n/a
 
      20th Aug 2004
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




 
Reply With Quote
 
 
 
 
Imran Koradia
Guest
Posts: n/a
 
      20th Aug 2004
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" <(E-Mail Removed)> wrote in message
news:412636f8$0$36861$(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
 
rob willaar
Guest
Posts: n/a
 
      20th Aug 2004
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:412636f8$0$36861$(E-Mail Removed)...
> > 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
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Imran Koradia
Guest
Posts: n/a
 
      20th Aug 2004
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" <(E-Mail Removed)> wrote in message
news:412644aa$0$78749$(E-Mail Removed)...
> 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" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:412636f8$0$36861$(E-Mail Removed)...
> > > 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
> > >
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      21st Aug 2004
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


 
Reply With Quote
 
rob willaar
Guest
Posts: n/a
 
      21st Aug 2004
Tnx Imran,Cor

I will use the booleans. You are right!

"rob willaar" <(E-Mail Removed)> schreef in bericht
news:412636f8$0$36861$(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if Component is not disposed? IdleBrain Microsoft VB .NET 8 17th May 2006 07:09 AM
Form Not Disposed?? I think...Not sure what I have done Tim Cowan Microsoft C# .NET 0 2nd Mar 2006 04:47 PM
Does a form automatically call Dispose() for each control it contains when the form itself is disposed? Roberto Rocco Microsoft Dot NET Compact Framework 3 16th Aug 2005 11:19 PM
when is the form disposed? Boni Microsoft VB .NET 7 20th Jul 2005 12:58 PM
How to check if Graphics object is Disposed SamSpade Microsoft VB .NET 6 11th May 2004 01:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:26 AM.