Stephen Byrom
asked on
hiding controls
Hi,
I have a number of labels on a form and they all have their visible property set to no.
I have given all labels Tag properties depending on which I want visible. So if the user selects "A" from cboRack then all labels with Tag property of "A" will show and all others will not. I am trying to show labels based only on a selection in cboRack.
I have this so far but keep getting an error.
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag = cboRack Then
ctrl.Visible = True
Else
ctrl.Visible = False
End If
Next
If I take out the else statement it works, but when the user changes the selection in cboRack, the original set of tags are still visible as well as the new selection. I'm trying to hide all labels with tags that are not = to the cboRack selection.
"Can't hide a control that has the focus"
Any help is greatly appreciated
I have a number of labels on a form and they all have their visible property set to no.
I have given all labels Tag properties depending on which I want visible. So if the user selects "A" from cboRack then all labels with Tag property of "A" will show and all others will not. I am trying to show labels based only on a selection in cboRack.
I have this so far but keep getting an error.
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag = cboRack Then
ctrl.Visible = True
Else
ctrl.Visible = False
End If
Next
If I take out the else statement it works, but when the user changes the selection in cboRack, the original set of tags are still visible as well as the new selection. I'm trying to hide all labels with tags that are not = to the cboRack selection.
"Can't hide a control that has the focus"
Any help is greatly appreciated
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER