Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42225

Dynamic Classes

$
0
0
I'm trying to figure out how to structure a large amount of data...

Here is a simple example:

Suppose I have up to 25 potential instances of objects (obj). Each of these objects has properties (name, color, type) which I've created in the class (myClass).

example objects:

obj1
Banana
Yellow
Fruit

obj2
Lettuce
Green
Vegetable

obj3
Apple
Red
Fruit

I place these into a multidimensional array:


Is it considered bad practice to create each object in a loop? Or is there a better way to do this?

Code:

For x = 0 to 24
dim obj(x) as new myClass
obj(x).name = array(x)(0)
obj(x).color = array(x)(1)
obj(x).type = array(x)(2)
Next


Viewing all articles
Browse latest Browse all 42225


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>