469,920 Members | 2,225 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

selecting an item from a vb.net listview

anyone have the code to select and listview item or row (subitems)
after a doubleclick event from a listview.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 15428
Larry -

Hope this helps:

Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListView1.DoubleClick
Dim itemPoint As Point = ListView1.PointToClient(Cursor.Position)

' This is the item that was double-clicked
Dim selectedItem As ListViewItem = ListView1.GetItemAt(itemPoint.X,
itemPoint.Y)
End Sub
Steve Stein,
Visual Basic Team

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
| From: larry mckay <la***@larrymckay.com>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: selecting an item from a vb.net listview
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <Oj**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vb
| Date: Wed, 22 Oct 2003 15:05:47 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:149280
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| anyone have the code to select and listview item or row (subitems)
| after a doubleclick event from a listview.
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|

Nov 20 '05 #2


i want to get all of the subitems as well.
I have the listview.view set to 'details' so i want to get all subitem
information as well. do you have any suggestions?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
Larry,

The subitems are in the selectedItem.SubItems collection

hope that helps

Steve Stein,
Visual Basic Team

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
From: larry mckay <la***@larrymckay.com>
References: <Oj**************@TK2MSFTNGP10.phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
Subject: Re: selecting an item from a vb.net listview
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <#u**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Date: Mon, 27 Oct 2003 15:08:24 -0800
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:151089
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

i want to get all of the subitems as well.
I have the listview.view set to 'details' so i want to get all subitem
information as well. do you have any suggestions?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

From: ss****@online.microsoft.com ("Steven Stein [MSFT]")
Date: Mon, 27 Oct 2003 20:46:35 GMT
Subject: RE: selecting an item from a vb.net listview
Newsgroups: microsoft.public.dotnet.languages.vb

Larry -

Hope this helps:

Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListView1.DoubleClick
Dim itemPoint As Point = ListView1.PointToClient(Cursor.Position)

' This is the item that was double-clicked
Dim selectedItem As ListViewItem = ListView1.GetItemAt(itemPoint.X,
itemPoint.Y)
End Sub
Steve Stein,
Visual Basic Team

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
| From: larry mckay <la***@larrymckay.com>
| X-Newsreader: AspNNTP 1.50 (ActionJackson.com)
| Subject: selecting an item from a vb.net listview
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <Oj**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vb
| Date: Wed, 22 Oct 2003 15:05:47 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:149280
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| anyone have the code to select and listview item or row (subitems)
| after a doubleclick event from a listview.
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Sean Chapman | last post: by
1 post views Thread by Bob Geltz | last post: by
4 posts views Thread by Paddy | last post: by
2 posts views Thread by David Anderson | last post: by
3 posts views Thread by Bry | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.