Results 1 to 3 of 3

Thread: controls.add in vb5?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    23

    controls.add in vb5?

    Hello,

    I'm relatively new to ActiveX, so you'll have to excuse my ignorance.

    I tried to add a dynamically created control to the controls collection of a form, but it seems that this is not possible since there is no Add method in this collection. I am using vb5. Is it because I'm using vb5 or am I missing something?

    If it is because I am using vb5, is there some workaround?

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    It's VB5. This code works for 6 but not for 5 :

    VB Code:
    1. Private Sub Form_Load()
    2. Dim TXT As Control
    3.  
    4. Set TXT = Me.Controls.Add("VB.TextBox", "ControlName", Me)
    5. TXT.Text = "aaa"
    6. TXT.Visible = True
    7. End Sub

    I guess a workaround is to have a control array and load the control with the next index and show it...
    Last edited by manavo11; Sep 21st, 2003 at 03:57 PM.


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    23
    Thank you for your response.
    Originally posted by manavo11
    I guess a workaround is to have a control array and load the control with the next index and show it...
    Yes, but the problem is that I will only know the name of the control at run-time. (I'm trying to make something with plug-ins.)

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