473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 15698
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: vince | last post by:
I need to programmatically select the first item in a listview before the listview is displayed, so far I'm not having any luck. Here's what I tried in the init for the listview... ...
1
by: Sean Chapman | last post by:
I was wondering how I would go about programmincally selecting a listView item in a listView since the Selected val is read-only. I can't seem to find any other method that will do this for me. I'm...
1
by: Bob Geltz | last post by:
I am able to populate a ListView with several detail lines (several columns). When finished, I would like to pre-select the first item in the list (before the user interacts with the list). This...
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
2
by: David Anderson | last post by:
I'm working on a Windows app that has a ListView containing a bunch of items. When the user clicks on an item, the app displays the item'd details. The user then has the opportunity to edit these...
3
by: Bry | last post by:
I know you can select a single item in a list view using the following code listView.Items.Selected = true; Is it possible to do this for all items in the listView control without using a...
2
by: Fritz | last post by:
I know it, I know it. It's come up a lot. I've done the Googling, but the standard answer doesn't do what I expect it to. For the record, the standard answer is: "Set the Selected property of a...
5
by: Bart Steur | last post by:
Hi, What's the best way to programmaticly select (click) another listview Item after removing the selected/focused one. using VB2005 Express. Thanks Bart
1
by: c35tar1 | last post by:
I have a ListView within a dialog. In code the groups are created and items added. Display is 100% correct. The problem is with using Shift to select multiple items in the list. - If you...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.