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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

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.
0
Mike Eghtebas
Asked:
Mike Eghtebas
1 Solution
 
Éric MoreauSenior .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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now