Visual Basic 2008 adding textboxes during runtime ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maniax
    New Member
    • Jul 2009
    • 1

    Visual Basic 2008 adding textboxes during runtime ?

    I am trying to make a program which adds 12 text boxes in a line when the user presses a button... however i want that button to be able to be clicked for as many times as the user needs... how can i accomplish that without having to write
    Dim tbox1 As New TextBox 10000 times?
    Last edited by debasisdas; Jul 29 '09, 08:59 PM. Reason: moved to.net
  • daonho
    New Member
    • Apr 2008
    • 18

    #2
    This is a hard problem. It is easier to add dynamic textbox using javascript which returns false to prevent postback; otherwise, you'll have to recreate these textboxes during postback if handling by .NET button control. Basically, in .NET, when the button is triggered, create the textbox and unique name/id to each of these textbox before adding to the form. You'll need to find a way to remember the number of created textbox, so you can re-create them on postback.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Please take a look at the insight on "How to use dynamic controls in ASP.NET. The example walkthrough is even roughly the same as you're trying to do.

      Comment

      Working...