-
1 Attachment(s)
Listview Selected Bug?
I have done a search and didn't find what I was looking for.
I have attached a small program to demo the bug. Just run the program and click on each button. You will know what I am talking about after looking at the code.
Technically, to solve the issue I could use the version 5 but I need some features that are in version 6 so any help?
I didn't find anything in MSDN or MS KB for known bug or workarounds.
Is MS aware of this bug?
Remember to run and click on the button without highlighting anything.
-
try this:
Code:
Option Explicit
Private Sub cmdRemove_Click()
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected Then
MsgBox ListView1.ListItems(i).Text
End If
Next i
End Sub
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To ListView2.ListItems.Count
If ListView2.ListItems(i).Selected Then
MsgBox ListView2.ListItems(i).Text
End If
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 5
ListView1.ListItems.Add , , "List" & i
ListView2.ListItems.Add , , "List" & i
Next i
ListView1.ListItems.Item(ListView1.SelectedItem.Index).Selected = False
End Sub
hope it helps
-
i take it this was the only line that actually changed:
ListView1.ListItems.Item(ListView1.SelectedItem.Index).Selected = False
?
-
-
Yes, it helps.
But WHY?
Who in the world was the first item selected = true when it shouldn't? It is not highlighted. Who did MS listen to? :mad: