hi there, im new in coding on visual basic, well, im new at coding at anything :)

i have a problem on my telephone directory program that i created about listview, i was wondering if i can click the item on a listview and show the result on a new window?

e.g. i click on a name and a new window pops up with his name,number and address?

thank you and more power to you guys. :)

Recommended Answers

All 4 Replies

Here's an article, that shows how to use the Click event, a MessageBox can then be used to display the Listview.SelectedItem

Try :

Private Sub ListView1_Click()
    Dim a, b, c, d As String
    Dim index As Integer

    index = ListView1.SelectedItem.index

    a = ListView1.ListItems(index).Text
    b = ListView1.ListItems(index).SubItems(1)
    c = ListView1.ListItems(index).SubItems(2)
    d = ListView1.ListItems(index).SubItems(3)

    'Set textboxes in form2 with value from listview
    Form2.Text1.Text = a
    Form2.Text2.Text = b
    Form2.Text3.Text = c
    Form2.Text4.Text = d

    Form4.Show
End Sub
commented: Great +3

thanks all especially you, JX Man :) i got it working.. now polish on some GUI designing.

thanks again, you guys really helped me a lot :)

solved.

You're welcome.
Don't forget to mark this thread as solved, it will help another members who has same problem like you.

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.