Positioning an array of textboxes in ASP.Net
Posted on 2005-04-18
I am trying to simply position an array of textboxes that have been dynamically created in the page load on a page.
Code I'm trying with is (actually copied from elsewhere for a button array!):
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Public textboxArray(9) As TextBox
Public Sub Addtextboxes()
For x As Integer = 0 To 9
textboxArray(x) = New TextBox
.Tag = x
.Text = "textbox " & x
.Size = New Size(60, 20)
.Location = New Point(20, (x * 20) + 4)
.Parent = Me
.Visible = True
Trouble is Size, Location, and Parent all give errors.
Does this mean that I CANNOT position and then reference an array of textboxes on an ASP.Net page, or is there another way of doing it.
The problem I'm trying to solve is to write a neat validation routine in codebehind, to validate the contents of 12 textboxes each of which contains the answer to a predefined question.
Its easy to write separate code for each, but a concise single routine would be technically good, and aesthetically pleasing.
(Sorry, running off at the mouth again!)