Solved

for loop for my labels

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now