Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I was wondering if someone could help me out with being able to double click an item in a listview, and then have that item appear in a textbox.

 

What is in the listview is just strings from a database.

Posted
In the DoubleClick event handler use the SelectedIndices or SelectedItems property of the ListView to get the item that was double-clicked and read the Text property of each Subitem.

 

 

Private Sub ListView2_ItemActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView2.ItemActivate
       TextBox1.Text = ListView2.SelectedItems
   End Sub

 

that is the code I have as of now. What would I add to selecteditems?

Posted
Like I said, use the SelectedItems property to get the item that was activated. If you look up the SelectedItems property in the help you'll see it's type and you'll be able to get a single item from it. Once you have a ListViewItem, as I said before, you need to read the Text property of each SubItem.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...