troubleshooting Question

Visual Basic 2005. processing Objects in a Control Collection

Avatar of michael_krell
michael_krell asked on
.NET ProgrammingVisual Basic ClassicRouters
4 Comments1 Solution279 ViewsLast Modified:
I am trying to make a sub function that hides all of a specified object on a form. I am trying to hide labels currently. I wrote the code fairly simply, but i cant seem to find a property inside of the Control object where a certain object can be distinguished.

Can someone tell me what property in the Control data type can be used to distinguish what the object is? "for example: text box, label, etc....."

Public Sub HideShowlabels(ByVal Visible As Boolean)
        Dim CtrlVar As Control
        If Visible Then
            For Each CtrlVar In Controls
                CtrlVar.Visible = True
            For Each CtrlVar In Controls
                CtrlVar.Visible = False
        End If
    End Sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros