glass_half_empty
Member
- Joined
- Feb 14, 2021
- Messages
- 6
- Programming Experience
- 1-3
I have a dialog form that has a list view control it. When the user selects a certain menu option from another form, this dialog form opens and the list view control is populated with file names & dates from a certain folder.
The multi-select option is set to TRUE and I would like the user to be able to select multiple file names within the list view by:
a) selecting one then holding either CONTROL or SHIFT and clicking others
b) selecting one then holding SHIFT and UP or DOWN arrow and selecting others
There are 2 buttons on the dialog form. One of them is named "CANCEL" and the other is named either "DELETE" or "OPEN" The multi-select option is only set to TRUE if the button is named "DELETE".
I use the Key Press event for the list view to trap the keys pressed:
How can I change this to work for me.
The multi-select option is set to TRUE and I would like the user to be able to select multiple file names within the list view by:
a) selecting one then holding either CONTROL or SHIFT and clicking others
b) selecting one then holding SHIFT and UP or DOWN arrow and selecting others
There are 2 buttons on the dialog form. One of them is named "CANCEL" and the other is named either "DELETE" or "OPEN" The multi-select option is only set to TRUE if the button is named "DELETE".
I use the Key Press event for the list view to trap the keys pressed:
need help here:
Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown
' This code has been tested and works correctly on 1/13/2021
Select Case Button1.Text
Case "DELETE"
If e.KeyCode <> Keys.Delete Then
e.Handled = True
Exit Sub
End If
Case "OPEN"
If e.KeyCode <> Keys.Enter Then
e.Handled = True
Exit Sub
End If
End Select
Button1_Click(Nothing, Nothing)
End Sub
How can I change this to work for me.