Remove Selection from a ListView Control in eMbedded VB
I wanted to completely clear the selection on a ListViewCtrl control but there seemed no simple way of doing it. I found that you need to loop through the items and unselect them. Interestingly, it seems that you can't iterate through the ListItems collection using a For Each loop, but a traditional For loop works fine.
Dim lvitem As ListItem
Dim i As Integer
For i = 1 To lstList.ListItems.Count
Set lvitem = lstList.ListItems(i)
lvitem.Selected = False
Next i
Theoretically, if you're not using multi-select you should just be able to go
lstList.SelectedItem.Selected = False
but I haven't tested it.
Labels: eMbedded Visual Basic, programming, windows CE



0 Comments:
Post a Comment
<< Home