Click to See Complete Forum and Search --> : BUG Fixing for terminate objects
corzar
October 22nd, 2001, 12:14 PM
There's a microsoft bug in VB. The class event terminate is not triggered when I set to nothing his object in a calling object. Is there a bug fixing of this? I'm not searching for a work around. Please give me some news.
Bye
Peppe
DSJ
October 22nd, 2001, 01:58 PM
This is working fine for me... are you up-to-date on service paks, etc?
corzar
October 25th, 2001, 08:06 AM
Yes, I updated my Visual Studio with Service Pack 3
DSJ
October 25th, 2001, 08:46 AM
So this doesn't work for you...?
'In form Module
option Explicit
private Sub Form_Load()
Dim o as Class1
set o = new Class1
set o = nothing
End Sub
'In Class Module
option Explicit
private Sub Class_Terminate()
MsgBox "Terminate Event"
End Sub
corzar
October 25th, 2001, 10:45 AM
no that works, instead this doesn't work:
class1
private o as class2
end class
sub class1_terminate
set o = nothing
end sub
sub class2_terminate
msgbox ("terminating")
end sub
DSJ
October 25th, 2001, 11:05 AM
Just from the code you posted, it doesn't look like Class2 ever get instantiated try this code...
'In Form module...
option Explicit
private Sub Command1_Click()
Dim o as Class1
set o = new Class1
set o = nothing
End Sub
'In Class1 Module...
option Explicit
Dim o as Class2
private Sub Class_Initialize()
'This is the line I don't see in your code...
'So your Class2 was already nothing and thus
'No Terminate should/would fire....
set o = new Class2
End Sub
private Sub Class_Terminate()
set o = nothing
MsgBox "Class 1 Terminate"
End Sub
'In Class2 Module...
option Explicit
private Sub Class_Terminate()
MsgBox "Class 2 Terminate"
End Sub
corzar
October 25th, 2001, 11:41 AM
Very very strange. I built an example similar to your. It works. But my project doesn't. I debugged it and I've seen that it doesn't fire the terminate event. It's very strange. I don't understand why. Maybe something in my class give VB some problems.
However thanks for help me.
Bye
Corzar
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.