CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 1999
    Posts
    21

    Object Name, how do I get it within class?

    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


  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Object Name, how do I get it within class?

    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...

    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Dec 1999
    Posts
    21

    Re: Object Name, how do I get it within class?

    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


  4. #4
    Join Date
    Dec 1999
    Posts
    21

    Re: Object Name, how do I get it within class?

    another reason I need to do this is because I need to create another object when I initilize the first object.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured