number of labels to set invisible...vb.net

I have 8 labels on a form.

Question: How can I make them invisible using something like this:
           Dim i As Integer
            Dim lbl As Label
            Dim strTemp As String
            For i = 1 To 8
                strTemp = "lblNewCust" & i
                lbl = Me.(strTemp)
                lbl.Visible = True
            Next

Open in new window


Please improve this code as necessary. I am getting error at line 6 ("identifier expected").

Thank you.
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
you can try:
lbl = CType(Controls.Find("Label1", true)(0), Label)

Open in new window

0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you
0
All Courses

From novice to tech pro — start learning today.