Dynamically Assign Instance Name
Posted on 2006-06-27
Hello, I'm working on my first .NET project, and have a need similar to what I've done before in Actionsctipt. I'm creating multiple instances of a custom class "Cycles," and would like to name them based on their machineID. In Actionscript, I would so something like:
Eval(strMachineID + "Cycle") = New Cycle(startTime, stopTime) ...or something similar
This would result with an instance of the Cycle class named 116Cycle if the machine's id was 116. I could then have multiple instances of the Cycle class (one per machine) and be able to reference them. That way, no matter how many machines were added or removed, my class instances would be made to match.
Thus far I have been unable to find anything regarding dynamically naming and referencing class instances in VB .NET. Am I missing something simple? Or... is there a better way to do it that someone could explain?