Listview selected item

lincstech
lincstech used Ask the Experts™
on
Hello,

Can anyone tell me how with a list view you can click the selected item and execute a command such as open a form ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015
Commented:
First set the MultiSelect property to False, then you can simply react to the Click event and retrieve the lonely item in the Items collection:

      Private Sub ListView1_Click(sender As Object, e As EventArgs) Handles ListView1.Click
            If ListView1.SelectedItems(0).Text = "YourItem" Then
                  'Do what you want
            End If
      End Sub

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial