rbarnhart1
New Member
- Joined
- Jun 29, 2011
- Messages
- 6
I'm just starting to learn how to create custom classes and objects and I don't fully understand it all yet. I want to create multiple objects from my custom class. But, I don't know how many I will need (it will be different each time I run the program). Because of this, I can't create object variable names in advance (if I knew I only needed three objects, I could create myObj1, myObj2, and myObj3 in advance).
In Excel, if I create a button, it is auto-named CommandButton1. If I create another one, it is called CommmandButton2. How do I do that in my own classes?
Since I don't know how many objects I'll need, the only option I can think of is this:
It seems like there has to be a better way. Any suggestions will be appreciated.
In Excel, if I create a button, it is auto-named CommandButton1. If I create another one, it is called CommmandButton2. How do I do that in my own classes?
Since I don't know how many objects I'll need, the only option I can think of is this:
Code:
ReDim object_arr (1 to max_size) As New myObjectClass
It seems like there has to be a better way. Any suggestions will be appreciated.