set invisible

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

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 ?
 
J

John Spencer

UNTESTED air code

Private sub Button_Click()
Dim ctl2 As Control
For Each ctl2 In Me.Controls
If ctl2.ControlType = acListBox Then
ctl2.Visible = False
End If
Next ctl2
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top