Click to See Complete Forum and Search --> : Object Name, how do I get it within class?


IanPye
February 28th, 2000, 05:30 AM
Hi,

I wonder if anyone can help, I have a class called for example MyClass. When my main module creates an instance of this class, i.e.


Dim Test as MyClass
set Test = new MyClass




What I need to find out within the class itself is the name of the new object I have created, in this case Test. The reason for this is that I am trying to create another object(different class) within this class. Any help would be apprciated.

Many Thanks

Ian

Clearcode
February 28th, 2000, 05:45 AM
You'll have to have a property such as "VariableName" which you explicityly set:

Dim Test as MyClass
set Test = new MyClass
Test.VariableName = "Test"




However, I'm mystified as to how this is going to be useful...

IanPye
February 28th, 2000, 05:51 AM
Thanks for posting so quickly! thats how I am currently working at the moment, I just wanted to reduce the amount of code needed to setup the object. The reason I want the name is so that I can create another object within my current object with the same name. sounds daft but it will reduce the amount of work needed within my project.

Thanks again

Ian

IanPye
February 28th, 2000, 07:38 AM
another reason I need to do this is because I need to create another object when I initilize the first object.