Looking for work? Check out our jobs area.

VB.NET

Moderators: seancampbell
Number of threads: 3618
Number of posts: 9200

This Forum Only
Post New Thread

Report
Automatic generation of textboxes in vb.net Posted by thushara on 5 Nov 2009 at 12:40 AM
<script language="vb" runat="server">
Sub generate(ByVal s As Object, ByVal e As EventArgs)
Dim i As Integer
' Dim numtexts As Integer
For i = 1 To 10
Dim t As New TextBox()
t.Text = "TextBox" & i.ToString()
t.ID = "TextBox" & i.ToString()
Controls.Add(t)

Next i

End Sub
</script>


error:Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server.

Report
Re: Automatic generation of textboxes in vb.net Posted by seancampbell on 11 Nov 2009 at 7:42 AM
This looks more like an ASP.Net Question to me.

http://www.asp.net/Learn/ajax-videos/video-286.aspx

Heres a great tutorial video where a guy explains it... you can also trying googling this:
"How to dynamically add TextBoxes to my ASP.Net Form"
or
"Dynamically add textbox asp.net vb.net"
or
"add textbox dynamic asp.net tutorial"

I am guessing that Controls.Add is not the method you want to use to add this textbox. You should probably be doing Form1.add() or something like that,
Good Luck
seanCampbell



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.