Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set invisible 1

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
BG
I have an interesting solution when all the list boxes are visible and i want to make only one of them visible :

Private Function SetVisible(ctl As Control)
' eg.g. SetVisible Me.ListBox1
Dim ctl2 As Control
ctl.Visible = True
ctl.SetFocus
For Each ctl2 In Me.Controls
If ctl2.ControlType = acListBox Then
If Not ctl2 Is ctl Then
ctl2.Visible = False
End If
End If
Next ctl2
End Function

Now i have another button with which i must set all the list boxes invisible, even the list box that is visible at the moment.How could i do that ?
 
You already have the essence of the code.

Code:
Private Sub SetListBoxesInvisible()
Dim Ctl As Control

   For Each Ctl In Me.Controls
     If Ctl.ControlType = acListBox Then
       Ctl.Visible = False
     End If
   Next Ctl
End Sub


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top