General discussion

  • Creator
    Topic
  • #2073353

    VB Object Names from their class

    Locked

    by jantkea ·

    Hi,

    I am creating a COM component for a website in VB. I have a buybasket and a sellbasket instances of a class called basket. I need to know from a basket call method which object instance is accessing it.

    Is there a simple way to do this or do you need more information? my direct email is [email protected]

All Comments

  • Author
    Replies
    • #3791801

      VB Object Names from their class

      by rskathait ·

      In reply to VB Object Names from their class

      Put a property Name in your class and then assing it your variable name as string. And use this property insedie your method to know the name of calling instance. This one is simple and easy solution. I will put better answer if I find one.

      rgds,
      rsKathait

      • #3792147

        VB Object Names from their class

        by jantkea ·

        In reply to VB Object Names from their class

        Please give a small code example to help me understand what you mean and I will give you the points.

    • #3792093

      VB Object Names from their class

      by rskathait ·

      In reply to VB Object Names from their class

      CODE FOR FORM1
      ————–
      Put two buttons on FORM1. One talks to buy basket and another to sell basket.

      Private buy As Basket
      Private sell As Basket

      Private Sub Command1_Click()
      buy.ShowName
      End Sub

      Private Sub Command2_Click()
      sell.ShowName
      End Sub

      Private Sub Form_Load()
      Set sell = New Basket
      sell.Name = “sell”
      Set buy = New Basket
      buy.Name = “buy”
      End Sub

      CODE FOR CLASS BASKET
      ———————
      Public Name As String

      Public SubShowName()
      MsgBox Name
      End Sub

      Rgds,
      rsKathait

    • #3792091

      VB Object Names from their class

      by jantkea ·

      In reply to VB Object Names from their class

      This question was closed by the author

Viewing 2 reply threads