Solved

Initializing class modules

Posted on 1999-01-07
1
156 Views
Last Modified: 2010-05-03
I am using VB4. I have created a simple class module and inserted it into my project. Later in my project, I use

  Dim x as new MyClass

How can I create an "Initialize" event for the class which will be called every time a new object of the class is created (in this case, x) ?


0
Comment
Question by:Sinclair
1 Comment
 
LVL 15

Accepted Solution

by:
ameba earned 50 total points
ID: 1454748
When class is instantiated, code in:
Private Sub Class_Initialize()
will execute (if any code is there)

So, put your init routines there.

Use Class_Terminate for your clenup code (freeing memory).
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best way to parse out a json string in VB6? 10 167
Adding to a VBA? 6 70
SQL VB connection works in one PC and doesn't in another 15 64
How to Add / Edit Windows Menu 4 60
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question