Robert

Robert

  • NA
  • 1
  • 0

Object naming strategies

Aug 9 2006 10:12 AM
Hello all, I am having a problem naming my objects and I was wondering if anyone could help me. I know the answer to this problem is probably really obvious and staring me in the face, but if anyone could still help me I'd be really, really grateful. My application uses a sequence of text boxes to display a specific mathematical calculation. I have created a class for each entry in the calculation, this class holds an individual piece of calculation data, as well as creating the text box within a scrolling panel. At runtime the objects are added to a sorted list. The question I have is how do I create unique object names at runtime? I planned to use a string ending with a increasing number e.g. Logger1, Logger2 etc. But when I use the string name the compiler naturally throws an error saying I can't name the object with that string name as it already exists. Is there any way to use the contents of string variable to name an object or would anyone recommend a different naming strategy for a situation where you don't know how many objects will be created at runtime? Can anyone help me out? With added apologies if the answer to this is really obvious. Cheers, Robert