The block Select Casedoes not work because the text "&edit"and "&delete". &will appear as part of the property Text.
Please note that if you are going to configure a function ContextMenuHanndlerfor each element that you clicked, then the best strategy would be to simply have a different handler for each
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
source
share