Visual Basic 2005. processing Objects in a Control Collection
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 Next Else For Each CtrlVar In Controls CtrlVar.Visible = False Next End If End Sub
Open in new window