Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for loop looping through labels?

Status
Not open for further replies.

LucasH

IS-IT--Management
Oct 28, 2003
93
US
Programming question here.


I have 4 labels:
label1
label2
label3
label4

I want to make a for loop to assign the text property of each one. Is that possible? I was thinking something like (I know this is wrong and probably stupid but it's my first guess and not the most experience programmer):

For i = 1 to 4
"label" & i & ".text = Hi"
Next i

Is this possible to construct the name of the object within a loop like this?
 
When you add a Label to a page by putting this in the html: <asp:Label runat="server" ID="Label1" />, the code in your page will have access to a member called Label1, to which you can set the Text property. If you had a array of labels, the you could certainly use a loop to set the text of them.

[blue]_______________________________________[/blue]
Business Logic:"AND when tweetle beetles battle with paddles in a puddle, they call it a tweetle beetle puddle paddle battle AND..." - Dr. Suess
 
There are a couple of threads in here regarding your issue.. use the search function of this forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top