Results 1 to 2 of 2

Thread: Adding at runtime controls to a form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    belgium
    Posts
    74

    Question

    Hello,

    On my form I have a textbox with the following name: txtTextBox
    I've also put an Index on it with the value 0.

    No I want to add a new textbox at runtime on my form with the same name, but with a new index.
    I did this:
    Code:
    Set btnObj = Controls.Add("VB.Text", "txtTextBox")
    With btnObj
       .Index = 1
       .Visible = True
       .MultiLine = True
       .Width = 2000
       .Top = 500
       .Left = 5500
       .ForeColor = vbBlack
       .Text = ""
    End With
    On the Set statement, i'v get an error with says:
    There is already a control with the name 'txtTextBox'

    So, can anyone tell me how I can add a new control with the same name.

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    There was a thread referring to this in the last few days. You might try using the LOAD command to create the object in a control array.

    Load txtTextBox(x)

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