Results 1 to 4 of 4

Thread: How to create controls at run time(dynamically)

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Unhappy How to create controls at run time(dynamically)

    Hai all,
    Here is my problem.I want to create the label controls and text box ,list box,command button based on the user requirement to generate the form.Anyone can help me in this please.

    Thanks in advance
    With regards,
    Karun

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    If you have VB6 you can add controls using the Controls collection of the form.
    VB Code:
    1. Dim txtBox As TextBox
    2. Set txtBox = Me.Controls.Add("VB.TextBox", "txtUniqueName")
    3. txtBox.Move 10, 10, 2000, 300
    4. txtBox.Visible = True
    Best regards

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59
    Hai Joacim Andersson,
    Thanks a lot Master.
    With regards,
    Karun

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    There is another way if you are interested. If you have one control of a kind (ex. text1(textbox)). Set its index to 0. Now in runtime to load another control just use
    VB Code:
    1. Load text1(1)
    2. Load text1(2)
    3. text1(1).visible = true
    4. text1(1).left = text1.left + 200 'or just move it so it isn't under the other control
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

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