Solved

Initializing class modules

Posted on 1999-01-07
1
154 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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now