Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 140
  • Last Modified:

select list box

i would like to know how to make a button that when pressed it would select all the contents of a list box and press another button to deselect all the contents of the same list box
0
440
Asked:
440
  • 3
1 Solution
 
a111a111a111Commented:
Option Explicit

Private Sub Command1_Click()
Dim A%
For A = 0 To 3
 List1.Selected(A) = True
 Next A
End Sub

Private Sub Command2_Click()
Dim A%
For A = 0 To 3
 List1.Selected(A) = False
 Next A

End Sub

Private Sub Form_Load()
Dim Entry
        List1.Clear
        Entry = "Hello"
        List1.AddItem Entry ' Add the entry.
        Entry = "Bill"
        List1.AddItem Entry
        Entry = "This Is"
        List1.AddItem Entry
        Entry = "a Test"
        List1.AddItem Entry

End Sub

0
 
a111a111a111Commented:
Hi,
if you need more assistent let me know.

Thank you.

0
 
a111a111a111Commented:
The key is:

List1.Selected(A) = True

and

List1.Selected(A) = False

Shay.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now