Results 1 to 3 of 3

Thread: [RESOLVED] [2005] ListView double click help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Resolved [RESOLVED] [2005] ListView double click help

    Hi Everyone,

    I have a ListView box that I am populating from a query against my machine. I would like to be able to double click the data in the box and have a popup box display the text I double clicked.

    For example,

    If the ListView is displaying the word "hard drive", I would like to be able to double click "hard drive" and have a message box pop up displaying the text "hard drive".

    I have tried using the below code, but it is not correct.


    Code:
    MsgBox(lvLocalDisk.SelectedItems.ToString)
    NOTE: lvLocalDisk is the name of my ListView box.

    When I double click the intended item, using the above code, I get the message box "System.Windows.Forms.ListView+SelectedListViewItemCollection"


    Can anyone help me with my problem? Thanks!

  2. #2
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] ListView double click help

    That is because of this:

    vb.net Code:
    1. Public ReadOnly Property SelectedItems() As System.Windows.Forms.ListView.SelectedListViewItemCollection

    So instead use:

    vb.net Code:
    1. MessageBox.Show(Me, lvLocalDisk.SelectedItems(0).ToString)

    That was freehand so tweaking my be needed.
    Prefix has no suffix, but suffix has a prefix.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Re: [2005] ListView double click help

    Hey Troy,

    Thank you for explaining that. Your suggestion worked perfectly. Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width