N
nokia33948
Hi,
I have a small big problem with classes and objects..
In VB6 I create a new project, DLL ActiveX; I leave the default name
("progetto1" - in italian); then I rename the class module in "cls1"; I
save the class module with name "cls1.cls" and the project file with
name "clsT.vpb"; and then I add these few lines to the class module:
Private Sub Class_Initialize()
Debug.Print "Class_Initialize()"
End Sub
Private Sub Class_Terminate()
Debug.Print "Class_Terminate()"
End Sub
Public Sub ini()
Debug.Print "INI"
End Sub
I set "5 - Multiuse" as Instancing for cls1, save again and run the
project.
VB.NET; I create a new project "windows application" type; I add a
button to the main form; I add as reference that "progetto1" saved
before (its simple since you can add a vpb project without compiling
it!); for the button click event I add the following:
Dim k As Progetto1.cls1
k = New Progetto1.cls1
k.ini()
k = Nothing
Save and run the VB.NET project too.
Now, pressing the button on the form I aspect to see in the "debug
window" of VB6: "Class_Initialize()", then "INI", then
"Class_Terminate()", but that does not happen! Only
"Class_Initialize()" and "INI" are printed, while "Class_Terminate()"
is only printed when I close the form!
Can someone explain me why this happens?
Sorry for my english...
I forgot to say that I use VB.NET 2003...
Grazie,
D.
I have a small big problem with classes and objects..
In VB6 I create a new project, DLL ActiveX; I leave the default name
("progetto1" - in italian); then I rename the class module in "cls1"; I
save the class module with name "cls1.cls" and the project file with
name "clsT.vpb"; and then I add these few lines to the class module:
Private Sub Class_Initialize()
Debug.Print "Class_Initialize()"
End Sub
Private Sub Class_Terminate()
Debug.Print "Class_Terminate()"
End Sub
Public Sub ini()
Debug.Print "INI"
End Sub
I set "5 - Multiuse" as Instancing for cls1, save again and run the
project.
VB.NET; I create a new project "windows application" type; I add a
button to the main form; I add as reference that "progetto1" saved
before (its simple since you can add a vpb project without compiling
it!); for the button click event I add the following:
Dim k As Progetto1.cls1
k = New Progetto1.cls1
k.ini()
k = Nothing
Save and run the VB.NET project too.
Now, pressing the button on the form I aspect to see in the "debug
window" of VB6: "Class_Initialize()", then "INI", then
"Class_Terminate()", but that does not happen! Only
"Class_Initialize()" and "INI" are printed, while "Class_Terminate()"
is only printed when I close the form!
Can someone explain me why this happens?
Sorry for my english...
I forgot to say that I use VB.NET 2003...
Grazie,
D.