Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

dynamically creating textboxes

Hi
i need  sample code for creating textboxs dynamically


i am using following code
but this will create only one textbox!


 Dim tb As New TextBox
 PlaceHolder.Controls.Add(tb)



0
Basic
Asked:
Basic
1 Solution
 
brdrokCommented:
is there a reason why you can't create multiple textboxes dynamically and add 'em into your placeHolder?

dim tb1 as New TextBox
dim tb2 as New TextBox


tb1.Style["Position"] = "Absolute";
tb1.Style["left"] = "175px";
tb1.Style["top"] = "200px"

//do same for tb2

PlaceHolder.Controls.Add(tb1)
PlaceHolder.Controls.Add(tb2)

to specify the location of your newly created textboxes, you'd set the style property of your textboxes.

at least it works like that in C#, not so sure about vb.net but I'd imagine syntax very similiar.

0
 
HavaganCommented:
Er, so create a loop...

For ...
     Dim tb As New TextBox
     PlaceHolder.Controls.Add(tb)
Next

or

While ...
     Dim tb As New TextBox
     PlaceHolder.Controls.Add(tb)
End While

Paul
0
 
BasicAuthor Commented:

i want each time i click a button
a new textbox will add to the placeholder

and please tell me how to get values of those textboxes
0
 
ihenryCommented:
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now