473,560 Members | 3,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 15707
Larry -

Hope this helps:

Private Sub ListView1_Doubl eClick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ListView1.Doubl eClick
Dim itemPoint As Point = ListView1.Point ToClient(Cursor .Position)

' This is the item that was double-clicked
Dim selectedItem As ListViewItem = ListView1.GetIt emAt(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***@larrymck ay.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.publi c.dotnet.langua ges.vb
| Date: Wed, 22 Oct 2003 15:05:47 -0700
| NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:149280
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.Su bItems collection

hope that helps

Steve Stein,
Visual Basic Team

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).
--------------------
From: larry mckay <la***@larrymck ay.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.publi c.dotnet.langua ges.vb
Date: Mon, 27 Oct 2003 15:08:24 -0800
NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:151089
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.m icrosoft.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.publi c.dotnet.langua ges.vb

Larry -

Hope this helps:

Private Sub ListView1_Doubl eClick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ListView1.Doubl eClick
Dim itemPoint As Point = ListView1.Point ToClient(Cursor .Position)

' This is the item that was double-clicked
Dim selectedItem As ListViewItem = ListView1.GetIt emAt(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***@larrymck ay.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.publi c.dotnet.langua ges.vb
| Date: Wed, 22 Oct 2003 15:05:47 -0700
| NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:149280
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
5187
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... LoadListView(); listView4.Items.Selected = true; Also tried to invalidate and get a redraw, didn't make a difference...
1
2044
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 using a listView to list some items and want to be able to delete one, then have it select the next one in the list automatically.
1
3396
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 way, if a user clicks on the OK button, there will be a default selection. I know how to use ListView.SelectedItems to get the selection, I just...
4
9701
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
2986
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 details. The user should click the Save button after each change, but of course that doesn't always happen. If the user makes changes and doesn't...
3
15694
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 loop? Thanks.
2
3692
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 ListViewItem to true." I also know from MSDN that the selection won't really take effect until the ListView has focus. My specific problem is that...
5
2531
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
2070
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 select the first item and then a second next to it, it reverses the selection - If you select the first item and then Shift to a few further down or...
0
7636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6194
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5176
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1171
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.