Correct Way to delete a hilighted item from an API Listview.
I have a API List View I created with the LVS_SINGLESEL style, so only one item can be selected at a time. What's the "correct" way to delete the selected item? The following works, but once an item is selected and deleted, I'll get the index for the first item in the box, even though there's no visible indication that anything is selected.
Thanks.
VB Code:
Dim lngIndex As Long
Dim retval As Long
'remove selected list view item
'get index of selected item
lngIndex = SendMessage(hListView, LVM_GETSELECTIONMARK, 0&, ByVal 0&)
'make sure something was selected
If lngIndex <> -1& Then
retval = SendMessage(hListView, LVM_DELETEITEM, lngIndex, ByVal 0&)
End If