Class Question

Posted on 2000-01-21
Medium Priority
Last Modified: 2010-05-02
Stupid Question coming up...

If i've got a class that contains


and I need to read multiple people into that class, so how do I go about declaring it as such?

Thanks in advance...
Question by:SJones
LVL 13

Accepted Solution

crazyman earned 40 total points
ID: 2374021

dim colTemp as new collection
dim ObjTemp as new MyClass
This adds a new class to the collection

ObjTemp.age= whatever
ObjTemp.Dob= whatever
ObjTemp.Name = whatever
coltemp.add objtemp

then you can loop through all your classes using

dim objTemp as MyClass
for each objTemp in colTemp
       debug.print objtemp.name
       debug.print objtemp.age
       debug.print objtemp.dob
next objTemp

Expert Comment

ID: 2374230
If you really need multiple people in that ONE class (I cannot imagine why, see crazyman's solution for a good implementation) then you should declare your members as collections or Array

Name() as string
Age() as integer
DOB() as Date

and the Redim them as you add a person


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

589 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