The Select Case
block isn't working because the text is "&edit"
and "&delete"
. The &
will appear as part of the Text
property.
Note that if you are going to customize the ContextMenuHanndler
function for every item that is clicked then a better strategy is to just have a different handler for each one
AddHandler i1.Click, AddressOf EditHandler
AddHandler i2.Click, AddressOf DeleteHandler
Private Sub EditHandler(ByVal Sender As Object, ByVal e As EventArgs)
ListViewToText()
End Sub
Private Sub DeleteHandler(ByVal Sender As Object, ByVal e As EventArgs)
Try
If ListView1.SelectedItems.Count > 0 Then
ListView1.Items.Remove(ListView1.SelectedItems(0))
End If
Catch ex As Exception
End Try
End Sub