12-13-2004, 05:20 AM
I'm working with a listview and i think it works wrong. If the user clicks on an empty row then will be another (not empty) automatically selected. Does someone observe this strage behaviour? I've tried to found the error and I find out that already
GetSelCountListView = SendMessage(lvw.hwnd, LVM_GETSELECTEDCOUNT, 0, 0)
returns a wrong value.
Sorry for my bad english and thanks for every help.
12-13-2004, 05:29 AM
Try this: Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To ListView1.ListItems.Count
If (ListView1.ListItems(i).Selected) Then
j = j + 1
12-13-2004, 05:59 AM
Thank you Robert, but the behaviour is the same. The message box returns 1 if the user clicks on the empty space in the listview and an empty is selected.
I don't know, why this selection happens. It is the last selected item, focus is not relevant. Anyone some idea?
12-13-2004, 06:06 AM
Put a 'break' at the beginning of the sub, and step through it. Each time through the loop, look at the value to see if it is incrementing, and then somehow getting decremented at the end. Also, if you know, by looking at it, how many items are selected, then that is the number of times it should go through the loop. By 'stepping' through it, you will get a better idea of what is actually happening, and that might lead to why it is happening.
12-13-2004, 06:17 AM
The item which be visualized as selected has .Selected = True. But why? If i deselect it than explicit then has all items .Selected Property = False. But not all the time. Than is suddenly True again. What the hell is this?
12-13-2004, 09:41 AM
haven't encountered this issue before but i believe listview is a little buggy control since i had had issues with the .Visible property, setting it to False sometimes doesn't have an effect at all. not sure but, this "may" be another bug :)