Results 1 to 3 of 3

Thread: set invisible

  1. #1
    Join Date
    Mar 2006
    Posts
    42

    Unanswered: set invisible

    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 ?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I assume that's not code you created? Can you find the bit that checks whether the current listbox is the one to be left visible? If so, get rid of that bit and it will hide them all.
    Paul

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Quote Originally Posted by peljo
    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
    Try this
    If Not ctl2.Name = ctl.Name Then
    ctl.Visible = True
    Else
    ctl.Visible = False
    EndIf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •