>>>How do you deselect a list item in a listbox?
>>>
>>
>>Try the ListItemId property of the listbox. Setting it to -1 makes no item selected. Example:
>>
>>? MyListBox.ListItemId
>>MyListBox.ListItemId = -1
>>
>Your answer got me thinking, there Ed:
>What if I go for multiple select type of listbox? Any way of deselecting ust one (optional) of the selected items?
Yep - iterate through the items and set the Selected property appropriately. If you know the ItemID for the item to select, deselect by:
MyListBox.Selected(nItemIDToChange) = .F.
To toggle an item's state, try:
MyListBox.Selected(nItemIDToChange) = ! MyListBox.Selected(nItemIDToChange)