VB.NET

Moderators: seancampbell
Number of threads: 3883
Number of posts: 9849

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 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.
Operated by CommunityHeaven, a BootstrapLabs company.