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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unselect item in multiselect list box 1

Status
Not open for further replies.

skyline666

Programmer
Oct 22, 2007
141
GB
Hi,

I have two list boxes, one a single select and one a multi select. I have a button which unselects the item in the single select list box, but it wont work for the multi select list box. Here is the code I have for the button:

Code:
Private Sub cmbUnselect_Click()

    Me.lstGrouping.value = 0
    Me.lstRisks.value = 0

End Sub

lstGrouping is the single select, and lstRisks is the multi select.

When I click the button, and there are items selected in the list boxes, then the highlighted item disappears in the single list box, but the item(s) in the multi select list box stay highlighted. How do I get the item(s) to be unselected in the multi select list box?

Many thanks in advance,

Andrew
 
Private Sub YourCommandButtonName_Click()

Dim varItm As Variant

With YourListBoxName

For Each varItm In .ItemsSelected
.Selected(varItm) = False
Next varItm

End With
End Sub

see
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top