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. 4 1316
a) this is a .net newgroup, not a vb6 one
b) your problem is caused the "multiuse instancing"
nokia33948 wrote:
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.
Try changing to the following:
Dim k As Progetto1.cls1
k = New Progetto1.cls1
k.ini()
Marshal.ReleaseComObject (k)
HTH,
--
Tom Shelton
Tom Shelton wrote:
Try changing to the following:
Dim k As Progetto1.cls1
k = New Progetto1.cls1
k.ini()
Marshal.ReleaseComObject (k)
HTH,
--
Tom Shelton
Thanks you very much Tom. That solved: both the problema and my
headache!
Rergards,
D. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: vrillusions |
last post by:
I've been using functions since I first started using php, but I've been
hearing more and more about classes, which I never really looked at that
much. I understand the whole OO programming...
|
by: David MacQuigg |
last post by:
Playing with Prothon today, I am fascinated by the idea of eliminating
classes in Python. I'm trying to figure out what fundamental benefit
there is to having classes. Is all this complexity...
|
by: Bo Peng |
last post by:
Dear Python group:
I am planning on an application that involves several complicated C++
classes. Basically, there will be one or two big data objects and some
"action" objects that can act on...
|
by: Marco |
last post by:
Howdy!
Given:
public abstract class A {
public abstract int A1(int i);
private class B {
private int B1(int i) {
int j;
|
by: Kevin Prichard |
last post by:
Hi all,
I've recently been following the object-oriented techiques discussed
here and have been testing them for use in a web application. There is
problem that I'd like to discuss with you...
|
by: Dave |
last post by:
Please - anyone that can help.
I am getting confusing results while trying to expose a collection from a
web service.
I have a webservice in which a web method accepts a collection as a...
|
by: weaknessforcats |
last post by:
Handle Classes
Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the...
|
by: stormogulen |
last post by:
Hi!
I'm having some problems figuring out how to organize the different
tiers of an application using a webservice.
The bottom layer is the DAL, and some of the objects in the DAL, I
would...
|
by: Immortal Nephi |
last post by:
First class is the base class. It has two data: m_Base1 and m_Base2.
Second class and third class are derived classes and they are derived
from first class. m_Base1 and m_Base2 are inherited into...
|
by: =?Utf-8?B?QmV0aA==?= |
last post by:
Hello.
I'm trying to find another way to share an instance of an object with other
classes.
I started by passing the instance to the other class's constructor, like this:
Friend Class...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |