Solved

for loop for my labels

Posted on 2004-08-30
1
208 Views
Last Modified: 2010-04-23
i have a whack load of labels that I have to reset and all i want to do is use a for statement but i don't know how to recognize my labels
this is what I have so far


the label.text contains information such as  18 19 20 21 b or (18) (19) 20 (21)
all my labels are named T18  T19 T20 T21 etc

the button will select  and change the numbers from 18 to (18) 19 to (19) etc.




  Private Sub btnRemoveAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemoveAll.Click


       Dim toothNumber As Integer = 11

        Dim index2 As Integer = 1
        Dim size As Integer = 8
        Dim textboxName As String

        Dim label As Label
   
            For index2 = 1 To size Step 1
'#### the funtion I am trying to represent should be textBoxName = "T18.Text"
                textboxName = "T" & toothNumber.ToString & ".Text"

            '######### then I want to call my function T18.Text = checkAllTeeth(T18.Text)

               textBoxName = checkAllTeeth(TextBoxName)

            Next
          End Sub

    Private Function checkAllTeeth(ByVal textSize As String) As String

        If textSize.Length = 2 Then
            Return "(" & textSize & ")"
        Else
            Return textSize
        End If


    End Function
0
Comment
Question by:genesisproject
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
ramesh12 earned 500 total points
ID: 11936659
dim ctl as control
for each ctl in me.controls
if typeof ctl is label then
--do whatever
end if
next
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

622 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