Solved

for loop for my labels

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 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