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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AUmidhConnect With a Mentor Commented:
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
0
 
AUmidhCommented:
Dim txt1 as New textbox
txt1.Location=New Point(x,y)
form1.Controls.Add(txt1)
txt1.Show()
0
 
bdb12Author Commented:
thx for your reply

.location & . show don't come up in intellisense....using VS 2005....
0
 
bdb12Author Commented:
Awesome ...thx man

Didnt need the InitializeComponent() tho
0
All Courses

From novice to tech pro — start learning today.