
December 3rd, 2004, 10:04 AM
|
|
Registered User
|
|
Join Date: Dec 2004
Location: Chattanooga, TN
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
How to construct the control name of a Label on a web form at runtime
I want to access forty Label controls in a table on my web page by using a Do Loop (or whatever) to access each Label control in sequence. I know the Label control names are Label1...Label40. How can I 'construct' the Label control name at runtime?
Dim intX, intEnd as Integer
Dim strLabelName As String
intX = 1
intEnd = 40
Do Until intX > intEnd
' contruct Label name
strLabelName = "Label" & Trim(CStr(intX))
strLabelName.Text = "whatever"
intX += 1
Loop
I realize that referring to the .Text using strLabelName won't work, but I don't know how to turn that StrLabelName into the ID (or whatever) for a Label control on the web form.
HELP !!! (and thanks a bunch)
|