Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

for loop for my labels

Posted on 2004-08-30
1
Medium Priority
?
212 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
1 Comment
 
LVL 7

Accepted Solution

by:
ramesh12 earned 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 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