ListView: what event at click by the mouse not on a list item?

Sergionik

Member
Joined
Sep 22, 2010
Messages
7
Programming Experience
Beginner
Hi!

Situation: ListView1 includes two items
When I move on items, all is normal, each of them is highlighted

But if any item of the list is chosen and I do click by the mouse within ListView1 but in not occupied with items of the list of area - "ListView1.SelectedItems.Count" it becomes equal 0

The problem because at me is others ListView which contents depend from chosen in ListView1.

And I will not understand what event to process, because on standard Click event it doesn't react

01.jpg
 
Last edited:
solution

I use event SelectedIndexChanged and property "ListView1.SelectedItems.Count"
When I click in area (see attachment, the red rectangle), property "ListView1.SelectedItems.Count" changes with 1 on 0

Then I check

Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.SelectedItems.Count = 0 Then
...code...
End if
End Sub
 
Back
Top