Displaying controls made in VB code

USing VB.NET & ASPX conntrols

If I create a control in the code

eg Dim txt1 as New textbox

how can I then display that control on the actual form?

I think it has something to do with aspx for that page, but Im not sure how to actual place the control Object so its on the form for the user to see....

thx
bdb12Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AUmidhCommented:
Dim txt1 as New textbox
txt1.Location=New Point(x,y)
form1.Controls.Add(txt1)
txt1.Show()
bdb12Author Commented:
thx for your reply

.location & . show don't come up in intellisense....using VS 2005....
AUmidhCommented:
Visit....
http://www.aspnettutorials.com/tutorials/controls/control-dym-aspnet2-vb.aspx
http://support.microsoft.com/kb/317515

i take it from the above

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    ' Create dynamic controls here.
    TextBox1 = New TextBox()
    TextBox1.ID = "TextBox1"
    TextBox1.Style("Position") = "Absolute"
    TextBox1.Style("Top") = "25px"
    TextBox1.Style("Left") = "100px"
    Form1.Controls.Add(TextBox1)

    TextBox2 = New TextBox()
    TextBox2.ID = "TextBox2"
    TextBox2.Style("Position") = "Absolute"
    TextBox2.Style("Top") = "60px"
    TextBox2.Style("Left") = "100px"
    Form1.Controls.Add(TextBox2)

    ' CODEGEN: The Web Form Designer requires this method call.
    ' Do not modify it by using the code editor.
    InitializeComponent()
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bdb12Author Commented:
Awesome ...thx man

Didnt need the InitializeComponent() tho
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.