Destructor: Am I thinking wrong? 
Author Message
 Destructor: Am I thinking wrong?

Why isnt the destructor called when creating a new instance, and overwriting
an previous? Eg:

Private x as Class1 'Private in a form

'Call new() for the first time
x = New Class1 (New() is called)
'Call it again
x = New Class1 (New() is called)

When I destroy the form, Destructor is called twice, but is there a way to
detect that already at line 2?
Or is there another event that will be called so I can cleanup the first "x"
before creating a new?
Or do I need to hard-code a call to a own "dispose" method before calling
New in the form?

Regards
Fredrik



Sun, 05 Jun 2005 16:25:14 GMT  
 Destructor: Am I thinking wrong?
Removing the reference from the object variable (whichever way you do it) is
not related to the object's destruction, except that it becomes eligible for
garbage collection. Use the Dispose method of the object while you still
have access to it - it is specifically designed to enable you to release
resources immediately.
--
Jeff Richards


Quote:
> Why isnt the destructor called when creating a new instance, and
overwriting
> an previous? Eg:

> Private x as Class1 'Private in a form

> 'Call new() for the first time
> x = New Class1 (New() is called)
> 'Call it again
> x = New Class1 (New() is called)

> When I destroy the form, Destructor is called twice, but is there a way to
> detect that already at line 2?
> Or is there another event that will be called so I can cleanup the first
"x"
> before creating a new?
> Or do I need to hard-code a call to a own "dispose" method before calling
> New in the form?

> Regards
> Fredrik



Sun, 05 Jun 2005 17:12:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. I think I am going mental

2. Suggestions.......sorry - I am bored and thinking

3. Recourse files, I think i'm using them in the wrong way

4. Recordset: What am I doing wrong?

5. What am I doing wrong??

6. What am I doing wrong?

7. Help with syntax. What am I doing wrong

8. What am I doing wrong?

9. What am I doing wrong?

10. What am I doing wrong?

11. Please tell me what I am doing wrong - DAO parameter Append Query :(

12. What am I doing wrong? -MultiSelect List box

 

 
Powered by phpBB® Forum Software