Results 1 to 4 of 4

Thread: create controls within code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    16

    create controls within code

    Hi everyone... i m new to VB... can anybody tell me how can i create a text box control within code...??

    thanks in advance...

    regards...

  2. #2
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Bath, England
    Posts
    411

    Re: create controls within code

    A little like this:
    VB Code:
    1. Dim TB As New Textbox
    2. With TB
    3.    .Location = New Point(20, 20)
    4.    .Size = New Size(50,20)
    5.    .Text = "This is a test"
    6.    .Visible = True
    7. End With
    8. Me.Controls.Add(TB)
    That's pretty much it. You can set all of the same properties in code as you can in the form designer.

    Oh, and welcome.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: create controls within code

    If you examine the code that is generated automatically by the form designer (when you drag and drop a new textbox onto a form) you'll get a good idea of how its done.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    16

    Re: create controls within code

    oh ! thats exactly wat i was lookin' for... thanks buddies.... u rock...

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