Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding a Textbox to a form at run time (Viual Basic 6.0)

    Hello,

    Can anyone tell me how to add 1 or more text boxes to a form at runtime?

    This is pretty easy in Office 2000, but I cannot seem to figure it out in VB.

    Thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding a Textbox to a form at run time (Viual Basic 6.0)

    Use the Add method of the Controls collection of the form:

    With Form1.Controls.Add("VB.TextBox", "txtText")
    .Visible = True
    .Left = 300
    .Top = 150
    .Width = 900
    .Height = 180
    End With

    Measurements are in twips; 1 inch = 1440 twips.

    See Add Method (Controls Collection) in the MSDN library for more information.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding a Textbox to a form at run time (Viual Basic 6.0)

    Thank you very much. I knew it would be a simple answer, but I just didn't have any luck finding it.

    Thanks again!

Posting Permissions

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