Results 1 to 4 of 4

Thread: Add textbox using code

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    7

    Add textbox using code

    How can I add a textbox into the form by using vb.net code for my web application?

    I write the following code but the textbox didn't appear:

    Dim newTxt As TextBox = New TextBox()
    newTxt.Wrap = True
    newTxt.Text = "Hello"
    Me.Controls.Add(newTxt)

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Add textbox using code

    Originally posted by Lim
    How can I add a textbox into the form by using vb.net code for my web application?

    I write the following code but the textbox didn't appear:

    Dim newTxt As TextBox = New TextBox()
    newTxt.Wrap = True
    newTxt.Text = "Hello"
    Me.Controls.Add(newTxt)
    make sure you choose the correct location for it....
    newTxt.Location = new point (....
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    7
    But 'location' is not a member of 'System.Web.UI.WebControls.TextBox'

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Lim
    But 'location' is not a member of 'System.Web.UI.WebControls.TextBox'
    are you making a web application ? perhaps you would post this in the ASP.NET section then. (if that's asp, I really dunno anything about web apps)
    I just tried this in a windows form applicatoin and it worked. (textbox inherits from system.windows.forms when making win form apps)

    Dim txt As New TextBox()
    Me.Controls.Add(txt)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

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