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

Clear selection(s) in a listbox

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
I usually clear selections in my listbox by using the following: With lstxx
For intI = 0 to .ListCount -1
.Selected(intI) = False
next intI
end With

However this little code does not work when the multi-select property of the listbox is 'None'.

Anybody have another neat lettle way to clear any selections in a listbox with the with the Multi-select set to None? Thanks for your help.
 
FYI, PWise, as I'm sure you know,

me.controlname=null

actually means

me.controlname.Value = null

and a Listbox, set to Multi-select, as in this case, no longer has the Value Property.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
The Missinglinq:

The OP said:
However this little code does not work when the multi-select property of the listbox is 'None'.
So now if the multi-select property is set to NONE
then
Code:
listBox.CouldHaveValue=True
 
BTW have you ever tried to set a multiselect listbox to null
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top