I have list view control where on change of selection, I do check - if selected record count is greater then zero then only enable group box controls else keep it disable. Because, those are controls are related to selected record only. if no record selected then it should not be enable.
Following is my listview's selected changed event:
Private Sub lv_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lv.SelectedIndexChanged
If lv.SelectedItems.Count() > 0 Then
...
.
ResetifNorecordSelectedState(False)
Else
..
ResetifNorecordSelectedState(True)
End If
Problem: On each time when user change the record selection then controls goes disabled and follow by enabled state. It makes some inconvenient design to user.
can any one share me solution or what should I change here to correct this issue. ?
Thanks
ListView fires a
SelectedIndexChanged
both when rows are selected and when they are deselected. So clicking a new row fires two events: one for deselecting the old row, another for selecting the new row.In your SelectedIndexChanged event, schedule another method to be run at idle time, but make sure to one schedule one of them:
Then in your
HandleDeferredSelectionChanged
you can do you work:These ideas from ObjectListView which already solves many of the problems you are going to have with
ListView
.