CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2000
    Location
    Holland
    Posts
    14

    Create TextBox (Code)

    Please Help,
    I want to create a TextBox on a Form by creating it with Code.
    (Not select it with a mouse and drag and drop it on the Form!)
    In that Code I want to set all its properties. How can I do this?
    Thanks


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Create TextBox (Code)

    in VB 6

    private Sub Command1_Click()
    Dim tx as Control
    set tx = me.Controls.Add("VB.TextBox", "test")
    tx.Visible = true
    End Sub





  3. #3
    Join Date
    Jan 2000
    Location
    Holland
    Posts
    14

    Re: Create TextBox (Code)

    Thanks,

    Just what I needed!

    Maarten


  4. #4
    Join Date
    Jan 2000
    Posts
    45

    Re: Create TextBox (Code)

    why dont you have the textbox already on the form, but set the visiblility to false, and set the properties by text1.whatever.


  5. #5
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Create TextBox (Code)

    How to make it work in VB5???


  6. #6
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: Create TextBox (Code)

    Add a textbox on the form, and make it Index 0, and set visible to false.
    In code,

    Load TextBox1(1)
    TextBox1(1).Left = 100
    TextBox1(1).Top = 200
    TextBox1(1).Visible = true





    Crazy D :-)
    "One ring rules them all"

  7. #7
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Create TextBox (Code)

    I need to make it as by "code" something like addcontrol thingy, so I was wondering if I could add control in vb some similar way, thanks tho for replying


  8. #8
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Create TextBox (Code)

    The only other way I can think of is use CreateWindow API but that's a bit of a pain.. Load .... is the closest you can get in VB5.

    Crazy D @ Work :-)

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

Featured