Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Loop through labelx.text =

Posted on 2008-11-10
Medium Priority
Last Modified: 2012-05-05
Is there a way to loop through labels to change the text value rather then

label1.text = "stuff1"
label2.text = "stuff2"

For x= 1 to 5
label(x).Text = "stuff" & x

or somthing
Question by:Rayzback

Accepted Solution

tiagosalgado earned 375 total points
ID: 22926798
Try something like

Dim x as Integer = 0
For Each lbl as Control In Me.Controls
If TypeOf lbl Is Label Then
lbl.Text = String.Format("stuff{0},x")
x = x + 1
End If

Open in new window

LVL 86

Expert Comment

by:Mike Tomlinson
ID: 22926929
You've posted in multiple Zones...please clarify which ENVIRONMENT you are working  in as each has very different approaches to this type of problem.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question