Question:
how to create textboxes during runtime in visualbasuc?
aski
2007-04-12 07:19:25 UTC
i need to create more than 10 textboxes during runtime
Three answers:
Pfo
2007-04-12 07:23:12 UTC
If it's .Net, in your form's load method



TextBox tb = new TextBox;

this.Controls.Add(tb);



Of course, you'll also want to programatically set the control's position, or even better use the flow layout panel to automatically layout controls.
Hassan Basri
2007-04-12 14:29:13 UTC
If it is Visual Basic 6.0



1) Create a textbox on your form. Make its Index = 0. Make its visible property to False.



2) Create a new textbox by calling

Load Textbox(1)

Load Textbox(2)

...



3) Don't forget to make their Visible properties to True or else you won't see them.
sharpturds
2007-04-12 14:33:36 UTC
Dim mybox As New Textbox()







then in the form_load event add this:



mybox.text="hi this is my box"

mybox.width = "22"

mybox.left = "15"

mybox.top = "15"



Me.controls.add(mybox)



Source(s):



hope it works for you i did somet like this...but i didnt type this in a vb.net so i cannot be sure its 100% acurate but thats the basic method...to create a new text box at runtime


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...