Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Class Initialize/class Terminate What Are They

What actions or activities should be accomplished in the class Initialize event? In the Terminate event?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Class Modules Initialize/Terminate
Trying to go into some greater depth with class modules and was reading MSDN Library subject "Class Module Step by Step". When stepping through the project with F8 I see the item go through the initialization of a class and setting it up. However I never see it go through the Termination of a class. The only reason I know a object is being destroyed is because in this example they have message boxes being displayed when an object is terminated.

Is there a way to determine classes that I create are properly destroyed/Terminated?

Reference To A Class In Another Class, Terminate Q.
OK, I have a Prarent Class say called Woof.
Woof has many child classes in a collection, call these Badgers.

So Woof has mnay Badgers...


When each badger is created the following is executed.

VB Code:
Dim objBadger   As Badger   Set objBadger = New Badger   Set objBadger.ParentWoof = Me   'Blah blah blah  

Now the problem arrises when I do:

VB Code:
Set Woof = Nothing

Since the terminate event doesn't get fired since all badgers have a reference to Woof and therefore it doesn't get terminated
Is there anyway to get round this??? Or is there anyway to have access to the parent object from badgers, with have a reference to Woof in badger...???

Does that make sense????

HELP! Deadline...3 hrs and counting...AM STUCK!


Initialize A Class
Hi, I want to initialize a variable having the name of a class. Is is possible or not? Thanks!


Class Module Initialize Event And Properties
Hi all,

I'm finally getting the hang of Classes and OOP (barely), but I had a question.

When I call my class, I have database connection code in the Initialize event that calls up another class that has all the connection code.

Now, the class does not know what database is going to be connected to, so what I wanted to do is pass a property (DBName) to the class and get it to read it before it calls the DB connection class.

So I have in a form

VB Code:
Dim obj as MyClassSet obj = New MyClass obj.DBname = app.path & "mydb.mdb"obj.RetrieveRecords

In the MyClass class, I have the following in the Class:

VB Code:
Option Explicit Private m_DBName As String Private Sub Class_Initialize()Dim obj As DBClassSet obj = New DBClass DBClass.DBName = m_DBNameDBClass.ConnectToDatabase End Sub

Is there any way to inforce the class to save the m_DBName and read it before it connects, or do I need to move the code from the Class_Initialize event and use another method where the DBName property can be set and read?


How To Terminate A Class??
I am useing a .dll to create a class instance of another application called PULSE. I am able to create the PULSE app fine, however when I try to close it from within the form, the application does not go away. The Library has a Terminate function for the class, but I dont know how to initiate it.


Public App As Object

' Start It - Start the Pulse Software

Public Sub StartIt()
Set Intense.PulseApp = New OleDll.CApplication
Set App = Intense.PulseApp.Application
End Sub

' Stop It - Stop the Pulse Software

Public Sub StopIt()
Set App = Nothing
End Sub

How To: Class Terminate Itself
I am trying to terminate a class from inside itself...How do i do it???

Class Terminate And Tiering
I need a little guidence here from a star player i think.
First of all im having a memory leak problem, it seems infinitely worse on 98 than XP, infact it almost non existant in XP anyway, heres where I think the problem coud be.

I have a .dll with a class, within this class it creates more classes just to use within itself. Should I be terminating these? ie set xx = nothing or will they self terminate when i terminate the 'dll class from the main program.

Er.. did anyone understand that, it reads like a script for the next Arnie film?

AND: does anyone know of any applications/utils that can track memory usage and leakage other than SmartCheck?, this seems to be a bit pricey.


Class Terminate...Not Firing...
OK I have an ActiveX EXE which can be run stand alone, or referenced from another project.
My problem is trying to terminate a class

I have a Sub called:

VB Code:
Public Sub Woof()Dim objNew  As clsNewObject   Set objNew = New clsNewObject   objNew.Show 'This displays the form that graphically represents the class.   Set objNew = NothingEnd Sub

Now, if this is called from Sub Main of the ActiveX EXE when it run as a stand alone then when I close the form my code terminates the object...BUT if I call the above from another form, then ther terminate event of objNew doesn't get fired TILL the entire project is terminted and not just my form...Any ideas???

Before anyone says that I have a memory leak or something like that, I haven't, well not to my knowledge anyways...My code for Show/Hide and closing form is as follows...:

VB Code:
'In my class I have: Friend Sub DestroyDisplay()    Set mfrmDisplay = NothingEnd Sub Public Sub Show()    If mfrmDisplay Is Nothing Then        Screen.MousePointer = vbHourglass        Set mfrmDisplay = New frmLTR        Load mfrmDisplay        Set mfrmDisplay.LTR = Me        mfrmDisplay.Show        Screen.MousePointer = vbDefault    Else        mfrmDisplay.ZOrder    End IfEnd Sub Public Sub Hide()    Screen.MousePointer = vbHourglass    If Not mfrmDisplay Is Nothing Then        Unload mfrmDisplay    End If    Screen.MousePointer = vbDefaultEnd Sub 'In my form I have:Private WithEvents mobjLTR      As LTR Public Property Set LTR(ByRef pobjValue As LTR)   Set mobjLTR = pobjValue   Call DisplayDataEnd Property Private Sub Form_Unload(Cancel As Integer)    mobjLTR.DestroyDisplay    Set mobjLTR = NothingEnd Sub

Any ideas?


Class Terminate Event
I have an application that creates instances of classes & has the capability of destroying them. As soon as my application creates a class object ( CreateObject(objvar) ) the event Class_Initialize() is triggered. I destroy the object by setting object variable to Nothing ( objvar = Nothing.)

Now as per the documentation on MSDN when all references to an instance of a class are removed from memory by setting all the variables that refer to the object to Nothing then Class_Terminate( ) event should get fired..But while debugging I cannot see the terminate event being fired. Am I missing some small detail? Please help..

Thanks & Regards,

Dumb Question: How To Terminate (unload) A Class Module Using A Form?
Does anyone know how to terminate a class module within a form?
I have declared a class module like this:

Private Variable As New ClassName
Now I want to unload the class without unloading the form. This won't work:

Set Variable = Nothing

Any ideas?


Using Class Is Class Object[RESOLVED(forNowAtLeast)]
I am relatively new to vb .... please forgive my ignorance, I'm in way over my head.

I am trying to debug a program that has been moved from vb (a stand alone application) to vba in excel.

I am having trouble with the class modules.

here is a chunk of the code that includes the spot where it is hanging up.

Passinfo is a class
pass is an instance of Passinfo

Printinfo is a class
pi is an instance of Printinfo

pass is a property of Printinfo
...start the code.....
Set pass = New Passinfo
For i = 0 To nbanks(stg) - 1

pi.pass(stg, i).code = pass_element(stg, i).code</i>......

.....end the code snippet.........

this code caries on for more properties.

when I run the program i get "Run -Time Error '91' Object variable or With Block Variable not set" error message

a class object can be a property of another class object right..?

this is probably too vague for anyone to be able to figure out, but any help ai can get would be greatly appreciated.

How To Reference An Object Created In A Parent Class From A Child Class?
I am trying to create a parent class object where the child references an object created in the parent object. Best practice programming says to keep your child object private so that it can't accidently destroyed. I do this by the first time this property is called(Table) it contains Nothing, so Visual Basic will create a Table object. That works great, but I don't know how to reference the mdb database object that is created in the Parent Class from the Table class. It keeps bombing on this line:

Set myTable = mdb.CreateTableDef(TableName)

in the Add routine saying an object is required. Any ideas on how to pass the mdb object in so that it not public?

This code references the Microsoft DAO 3.51 Object Library

Here is my code:

In a module:

Sub Main()

Set testdb = New objDB

testdb.CreateDB Name:="Test", Directory:="C:WorkMike", BackUp:=False

testdb.Table.Add TableName:="Test", _
FieldNames:="UniqueID,ArrayCalcName,ArrayCalcAge,Formula,ActualResults", _

Code in objDB class:

Private mdb As Database
Private DbName As String
Private DbDirectory As String
Private DbBackUp As Boolean
' Storage for the property is private, so it can't be set to
' Nothing from outside the object.
Private dbTable As New Table

'Gets the directory of files to create the DB from
Public Property Get Name() As String
Name = DbName
End Property

'Gets the where the directory is saved at
Public Property Get Directory() As String
Directory = DbDirectory
End Property

'Sets where to save the DB
Private Sub CreateDirectory(Data As String)

On Error GoTo EH:

Dim NewData As String
Dim BackSlashPos As Integer

BackSlashPos = 1

If InStrRev(Data, "") <> Len(Data) Then
Data = Data & ""
End If

Do While Dir(Data, vbDirectory) = vbNullString

BackSlashPos = InStr(BackSlashPos + 1, Data, "")
NewData = Left(Data, BackSlashPos)
If Dir(NewData) = vbNullString Then
MkDir NewData
End If


DatabaseDirectoryData = Data


End Sub

'Gets the directory of files to create the DB from
Public Property Get BackUp() As Boolean
BackUp = DbBackUp
End Property

Sub CreateDB(Name As String, Directory As String, BackUp As Boolean)
On Error GoTo EH

DbName = Name
DbDirectory = Directory
DbBackUp = BackUp

'delete previous db made
If Dir(Directory & Name & ".mdb") <> "" Then
Set mdb = Nothing
Set DBrecordset = Nothing
Kill Directory & Name & ".mdb"
End If

Set mdb = DBEngine.Workspaces(0).CreateDatabase("C:WorkMike est.mdb", dbLangGeneral, dbVersion30)

Exit Sub

MsgBox Err.Number & Err.Description

End Sub

Property Get Table() As Table

' The first time this property is called, dbTable
' contains Nothing, so Visual Basic will create a
' Table object.
Set Table = dbTable

End Property

Code in Table Class:

Private myTable As TableDef
Private DBrecordset As Recordset
Private dbindex As Index
Private indexfield As Field

Public Sub Add(TableName As String, FieldNames As String, DataTypes As String)

Dim TableField As Field
Dim x As Integer
Dim FieldsArray As Variant
Dim DataTypesArray As Variant
Dim DataType As Integer

Set myTable = mdb.CreateTableDef(TableName)

If InStr(FieldNames, ",") Then
FieldNamesArray = Split(FieldNames, ",")
FieldNamesArray = Array(FieldNames)
End If

If InStr(DataTypes, ",") Then
DataTypesArray = Split(DataTypes, ",")
DataTypesArray = Array(DataTypes)
End If

For x = 0 To UBound(FieldNamesArray)

If x <= UBound(DataTypesArray) Then
Select Case Trim(LCase(DataTypesArray(x)))
Case "dbtext"
DataType = 10
Case "dbmemo"
DataType = 20
Case Else

End Select
End If

Set TableField = Table.CreateField(Trim(FieldNamesArray(x)), DataType)
Table.Fields.Append TableField

Next x

End Sub

Making A Class Property Public To Another Class But Private Everywhere Else
The title pretty much says it all. Basically I have a class that implements another class. The implemented class has index and ordinal properties I want the parent class to be able to set.

In order to do that, the properties must be public which means that anything that implements the parent class can change those properties.

I can only find one way around it and that is to subclass every property in the implemented class.

is there a way to declare a property public only to classes that use it?

I don't know how to use the Implements keyword or the Friend keyword, but I tried declaring the property as a friend property and it didn't prevent the property from becoming public throughout the project.

Any ideas?

Use Populated Collection Class In Seperate Class
I have a collection class (clsCol), with a sublclass (clsValidate) to validate the input before adding any variables to the collection.

I would like to use the collection in another class (clsSearch) , but am unsure how to use it without creating another instance of the clsCol collection - i need to the use the collection after is fully populated, so i can perform some functions on it.

How can i include the fully populated collection class into my new class, clsSearch?

Quick Question About Classes (to Class Or Not To Class)
I recently read a book about classes and have incorportated it into my current project. I have went from using 7-8 MB of RAM at runtime to 3-4 MB of RAM at runtime by using classes instead of public variables.

I would like to implement any change that increases the efficiancy of my program. In this I have considered going from opening a database at startup and closing at shut down to using a class to open and close as needed.

I am having a hard time realizing the pros and cons of this change. If I understand the concept it would be better but I am having a hard time understanding why it would be better.

So my questions are, would it be better? If so, why? What are any disadvantages to this change.

I think it would be better because I would not be maintaining an open connection to a database. I am not sure how to code the mdb path except to make it a constant and only use the get property.

By the way, I am using DAO not ADO.

Thank you for your help.

Accessing An Instance Of A Class Outside Of The Class That Instantiated It.
I have a class (say Qbert) in a windows project that I create an instance of ( say MyQbert) in the main MDI Container. How do I share this particular instance (MyQbert) with all of the various forms I use in that container? I do not want to create another instance of Qbert as I need to access properties previously assigned to MyQbert. Thanks for the help!!

Set Collection(Class) = Class - Doesn't Work
I have two collections:

obj_Loads has these properties:
_____ pkLoads
_____ LoadNumber
_____ AutoclaveID
_____ ContainerMax
_____ LoadType
_____ blnProcessing
_____ sysDateEntered
_____ obj_InDespatch

obj_InDespatch has these properties:
_____ pkInDespatch
_____ fkLoads
_____ fkMaster_Schedule
_____ ContainerID
_____ sysDateEntered

Why can't I do this statement?

Set allLoads(1).obj_InDespatch(1) = allInDespatch(1)

I get the "Object does not support this property of
method" error

I can set the individual properties of
the objects like so:

allLoads(1).obj_InDespatch(1).pkInDespatch = allInDespatch(1).pkInDespatch

Any ideas???????

Can A Class &"Self Terminate&"
We all know "Terminators" can't self-terminate... but what about classes (or instances thereof)?

Can an instance of a class set itself to Nothing?

If yes... HOW??
If no... pls say so.


How To Inherit A Class From Another Class And Use Both In A Form
I am trying to inherit a class from another class and trying to use them both in my form.

I have a base class clsRecordset, which is used for making connection to the database and also execute the Stored procedure.

The clsCustomers inherits the clsRecordset to get the resultset from the database and use it here. This class also has two methods which gets the loginname and the password from the user(form frmLogin) and checks with the resultset given by the cls Recordset.

The form uses both these classes.

I am getting an error message "run-time error 91 : object variable or with block variable not set" in the line recc1.Get_Conn ("customer_check") in my form.
please help me in getting rid of that error. I appreciate any help. thank you. I am inlcuding the complete code I used in VB 6 and the server used is MS SQL server 2000. If any part of the code is not clear please allow me to explain it.

1. Class clsRecordset:
Option Explicit

Public m_conn As ADODB.Connection
Public m_recc As ADODB.Recordset

Function Get_Conn(querystring)

Set m_conn = New ADODB.Connection
m_conn.Open "Buy", "sa", "S!2E@8N&7"

Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = m_conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = querystring

Set m_recc = New ADODB.Recordset
Set m_recc = cmd.Execute

End Function
2. Class clsCustomers:
Option Explicit

Private m_CustomerObj As clsRecordset
Public m_strcustlogin As String
Public m_strcustpass As String
Private m_session As Boolean

Private Sub Class_Initialize()
Set m_CustomerObj = New clsRecordset
End Sub

Public Sub Check_Members()

With m_CustomerObj.m_recc

Do While Not .EOF

If .Fields("customer_login") = m_strcustlogin And .Fields("customer_password") = m_strcustpass Then
m_session = True
Exit Sub
m_session = False
End If

End With

End Sub

Public Sub ShowInfo()

If m_session Then
MsgBox "User Information InValid", vbInformation + vbOKOnly, "Invalid User Information"
End If

End Sub
3. Form frmLogin:
Option Explicit

Private Sub btnLogin_Click()

Dim recc1 As clsRecordset
recc1.Get_Conn ("customer_check")

If Not txtLoginname.Text = "" Then

If Not txtPassword.Text = "" Then

Dim CustomerObj As New clsCustomers

CustomerObj.m_strcustlogin = txtLoginname.Text
CustomerObj.m_strcustpass = txtPassword.Text


Set CustomerObj = Nothing


MsgBox "Enter your Password", vbOKOnly + vbInformation, "Enterpassword"
Exit Sub

End If

MsgBox "Enter your Login name", vbOKOnly + vbInformation, "EnterLoginName"
Exit Sub

End If

End Sub

Class, Array/Collection Within Class

I am using a class to represent a object in my application. One item of such class(a property) could be having multiple itmes for some instances. I mean if I've Class A and P is a property of A, I could have multiple Ps for one instance of A. Like A.P1, A.P2, A.P3 etc. What is the best concept in Vb that I could use to represent such property? A collection? A array? Thanks for any suggestions

Class Calling Another Class (Resolved)
I have two classes, one of them (Class1) stores a collection of the other (Class2).

I would like Class 2 to call an update within Class 1 while class2 is busy working (i.e. progress report) which will ultimately call a UserControl and update a progress bar on the form (Or whatever).

This way I hope to inform the Form of the progess state.

I hope that makes sense, can anyone lend a helping hand?

Currently I am passing the form object and a function name to the control, then to the class, and calling it back - but I'm sure there's a more structured approach.

Instance Of A Class And Component.Class
Hi All VB Masters,

This time i m not facing any problem but its a littlebit confussion. I created a dll "MyDll" having one class "MyClass", i register it and in std exe project set the reference to MyDll. Now when i am about to create an object of it, as follows,

Dim MyObj as new MyDll.MyClass

This is ok, i know this method very well to create the instance of Class. But i m also able to create the instance of class as follows,

Dim MyObj2 as new MyClass

Now this is confusing for me. I know the std method for creating the instance is "Component.ClassName". But if i can create the instance directly by specifying the class name only, then why should i use "Component.Class".

Please tell me is there any disadvantage of creating instance by second method? Is there is reason so that one should go for first method only? Is coding std's states that we should define the object by first method only?
If you know any url from where i can get detailed information about this please send me.

take care

Private Class Called Within Class

I'm wondering how you make a class private when calling it within another class. I assume you would say:

Public MyClass As New clsMyClass

But how would you set up the Get and let statements?


Class - Collection/Array Within Class

I am using a class to represent a object in my application. One item of such class(a property) could be having multiple itmes for some instances. I mean if I've Class A and P is a property of A, I could have multiple Ps for one instance of A. Like A.P1, A.P2, A.P3 etc. What is the best concept in Vb that I could use to represent such property? A collection? A array? Thanks for any suggestions

How To Retreive A Form As Class From Its Class Name
Hi All, i have the name of the form in a string(i.e. retrieved from a table), i want to be able to show this form using the from name

for example the Form name is "FormTest", which i hold in a string variable, i want to be able to show this form.

Any command similar to FindClass in Visual Java++


How To Retreive A Form As Class From Its Class Name
Hi All, i have the name of the form in a string(i.e. retrieved from a table), i want to be able to show this form using the from name

for example the Form name is "FormTest", which i hold in a string variable, i want to be able to show this form.

Any command similar to FinClass in Visual Java++


How To Catch Events Of One Class In Other Class

how can i catch events raised in one class module in other class module. i have declared the variable in target class with WithEvents keyword but the event is not showing in right hand side drop down menu

please help




Class? Can I Loop Through All Properties In My Class Like So
CODESet gblClsDemo = New clsDemographics
         With gblClsDemo
         For Each Property In gblClsDemo
            MyDemo = CheckforXML("", "", .What_goes_here)         
         End With

Pass A Class Object Into A Class
Question (1)
I have declare a classA object in the main and want classB to use this object inside classB domain. may i know how to i go about doing it.

Question (2)
How do i pass an array to a function and let this function returns as an array.

To Identify A Class Instance From The Class Itself
I will ADORE him as a GENIUS if he give me a solution. I am having Mdichild form in which there is a command buton called list exists. I added a user defined dll project to my current project, where a class had defined in that. The class having a property called "SHOWSCREEN" in which i am showing a form. I create an instance of that, when i again create another instance, the previous instance should come. How can i do this. I want to control this, from the class itself, not from the active form.

Line 31: Class PowerPointCtl.Slide Of Control Slide1 Was Not A Loaded Control Class
What is it mean by this error?


Line 31: Class PowerPointCtl.Slide of control Slide1 was not a loaded control class.

Class MSComDlg.CommonDialog Of Control DlgCommonDialog Was Not A Loaded Control Class
I can't open a frm file because I get the following:
Line 18: Class MSComDlg.CommonDialog of control dlgCommonDialog was not a loaded control class.
Line 50: Class CImage10.CImage of control CImage1 was not a loaded control class.
Line 81: Class MSComctlLib.Toolbar of control tbToolBar was not a loaded control class.

Please help.



How To Return A Class Object From A Member Function Of Another Class Object
I have declared a class Customer as

Option Explicit
Dim CustomerId As Integer
Dim CompanyName As String
Dim City As String

Then i am declaring another class CustomerData in which i am having a function
Public Function GetCustomer(id As Integer) As Customer
i want this funtion to return the Customer object which will have the same Customerid as the of id provided to the function.
Here i am using Oracle SQl as backend with customer as the name of table

How to implement this function???

Calling A Class From Another Class
Hi All.

How is the correct way to use and call an activex dll from another one?

I have a problem with my new driver development. Was made to use as a plugin for an astronomy software called CCDSOFT and it controls a focuser interface based on a PIC microcontroller via serial port.

Supose that the name of the first dll is JMIPIC.dll and the main dll is NGFS.dll then, to use JMIPIC properties and method from NGFS can i do the following?:

1) At NGFS module: Public Interface as JMIPIC
2) In "Class Initialize" on NGFS class: Set Interface = New JMIPIC

I am getting a "Type Mismatch" error when NGFS is initialized by the client software. Both dll are correctly registered.

I have uploaded the dlls to see if anyone can help me to see what is wrong.

Thank you.

Best Regards.

Can One Class Know The Object Of Another Class?
Let's say I have two class modules one called Apple and the other called Orange.

Now in a .bas file I have the following declarations:

Public appl As Apple
Public oran As Oranges

Now in the main Form I have some code like this:

Set appl = New Apple
Set oran = New Orange
So my question is; is there a way in class Apple, for example, it has a way of knowing that oran was set as the object of class Orange?

How To Access Var Of One Class From Another Class
Plz tell me that how a var of one class can be accessed from another class.Suppose a coonection type var is in a class named "clsconnection".@nd class is of "adddata".I wantt to access the var of first class that is of connection type to execute the query that resides in the 2nd class.


A Class Within A Class Module?
I have a Class Module called Client and in that Class Module I want a class called Account which will hold 2 strings (Username and Password.) So when using this class module it would look like this.

Client.Account.Username = "Guest"
Client.Account.Password = "secret"

When I typed the following in my Class Module it was giving me errors:

VB Code:
Public Class Account     Public Username as String     Public Password as StringEnd Class

However, once I hit enter on the first line "Public Class Account" that damn message box would pop up and say "Compile Error: Expected End of Statement" and it hilights "Account"

And when I type End Class and hit enter it hilights class and says, "Compile error: Expected: If or Select or Sub or Function or Property or Type or With or Enum or end of statement"

I must be using classes wrong? Or am I not suppose to be using classes at all?

Converting A Class In An EXE To A Class In A DLL
I realized recently that that class I am making would be more useful if it were in a DLL and could be easily referenced from any project. I tried simply adding a DLL to my project, removing the class in the EXE project, then using "Add File..." to add the class in the DLL project, but some errors came up. I have no idea what to chose for the "Instancing" property of the class and any properties that are available after you select an one of the instancing options.

Also, should I make any other changes in the class now that it is in a DLL? Like the way I call it on a form? Right now I am doing this: (Late-binding... I think... I always get them mixed up)

VB Code:
Private MyHTML As HTMLCode Private Sub Form_Load()  Set MyHTML = New HTMLCodeEnd Sub

Should I do anything different if it is in a DLL?

One other question on a related note: The class I am making is going to be used for parsing HTML source code and can mostly be used for getting certain information out of the source. I have a property call Source, but it does not server any purpose directly at the moment because all the functions that deal with the source require you to pass the code as an argument.

Based on other classes I have seen, I think it might be better deal with the the code inside of the Source property instead of having the user pass the source each time then need one of the methods of the class. Sorry if this doesn't make sense, but its hard to explain without giving a big example. If no one understands I will post some code.

Call Class From Within Class??
How do call one class from inside another?

That's it.

I know you need the implements keyword, but my knowledge ends there.


A Class Inside A Class?
Hi there

Can someone please tell me if it's possible to have a class inside a class? ie. I have 2 classes, one is called CStudent, and the other class is called CCourseGrade.

CStudent has these properties: StudNumber, StudName, GPA.

CCourseGrade has these properties: CourseNumber, CourseName, Credits, and Mark

For my CStudent class, can I also include CCourseGrade as one of the properties in the CStudent class?

If so, how do I do this properly?

Would it be right to do this in my CStudent class?

Private mcCourseList As CCourseGrade

Public Property Let CourseList(pcCourseList As CCourseGrade)
mcCourseList = pcCourseList
End Property

Public Property Get CourseList() As CCourseGrade
CourseList = mcCourseList
End Property


I have a class <clsDataType2> with a number of properties
I have a class <clsParticipant> with a number of properties

I want to have a collection of participant in my datatype2

For 1 element in datatype2, 0..n participant...

How can I do it? I have never do that (and my knowledge is restricted)

I am starting like that..
'Created by MAQUEJE // 2006-Mar-15
Option Compare Database
Option Explicit
Private m_clsParticipant As Collection
Private mintNrOfParticipant
Private cls_participant As clsParticipant
Private m_clsInstitutionVisited As Collection
Private mlngProjectId
Private mlngtxtProjectActiID
Private mlngcboProjectStatID

'Created by MAQUEJE // 2006-Mar-13
'Modified by MAQUEJE // 2006-Mar-14 (Due to invalid use of null error, not using the data type definition)
Option Compare Database
Option Explicit
Private mlngIndiId
Private mstrNameShort
Private mstrAddress1
Private mstrRegion
Private mstrTown
Private mstrCounName
Private mintAge

Class As Property For Another Class?
Is it ok to make a class a property of another class?

I have a class Cbaffle

that has a property perfComp

I have another class Cperf

Cperf class has a property guage

I want perfComp to be an instance of the Cperf class

how can I set the

Cbaffle.perfComp.guage property ?

is that at all clear?

I have created the classes and they work fine independently... but i can not us them together

the baffle class contains top level info about the unit ie: overall dimensions, and component types..

these component types have measurements of their own.

i want the component types to be a property of the baffle class and I want to be able to set the properties of the component types for a particular baffle

thanks for any help

Using .class (Java Class) In VB

i would know how to use a compiled java class in vb.

Thanks in advance.

How To Raise A Event In A User-defined Class Module And Handle This Event By The Same Class Module?
Hi! Everybody!
I meet a question. How i can raise a event in a user-defined class module and i want use one function to handle this event in the same class module? It means i want to event source and the event sink in the same class! How can i achieve it?
Thank you anybody's help!
Thank you very much!

Adding An Object From A Class Collection To Another Class Collection
I have a problem in that I am have created two class collections and I want to add to the first class collection an object comprising more than one object from the second class collection.

I think is it possible but I have no idea how to do it. I have created a wrapper for the add, delete and Item methods and the count property, but I do not know how to word the code to take the data into the object.

I want to only add the objects that relates to the first object! But I thought add the lot and then delete those that do not apply, but still can not work that out. Any help of suggestions will be gratefully received.

I have attached a zip file with the information, in it are a 5 PDF files with the classes, collections and the main module.

Anticipated thanks.

What Is Application Global Class And Application Local Class?
I read about above two classes in MSDN. But I cann't understand completely the differences between two of them.

My word is very short ? isn't it?

But I don't know the differences between two of them absolutely.

Any kind explanation about the two of them will make me happy a little.

Thank you For reading my letters

To Class Module Or Not To Class Module, That Is The Question
I am using access 2003 and I am going to be executing a series of different queries on an SQL database, the results will be displayed in an excel workbook, I am wondering if there is any benifit in using class modules, or whether this will over engineer the whole project.

any ideas?

VB Class Like VFP Class
How to create VB class at design time? not from writing code from modul, just like createing class from visual foxpro?


Is There Something Like A Class In Vb?
i want to make something like this :
an object that will have difrent types of params and function and that i will able to do :

Copyright 2005-08, All rights reserved