Solved

for loop for my labels

Posted on 2004-08-30
1
207 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

752 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