473,408 Members | 1,822 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,408 software developers and data experts.

Listview item key

Assuming lv.items.add(key,text, image index)

In a listview with items and subitems in each row, how do we
get the key value of the selected row?

The examples I see check for selectedindices it seems. In
VB6 I used a API method but surely in .Net there's such a
inbuilt method?

Thanks,
Adam
Apr 19 '06 #1
3 9059
Hi Adam,

Try with the ListViewItem.Name property for the selected items.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> escribió en el
mensaje news:ug**************@TK2MSFTNGP03.phx.gbl...
Assuming lv.items.add(key,text, image index)

In a listview with items and subitems in each row, how do we
get the key value of the selected row?

The examples I see check for selectedindices it seems. In
VB6 I used a API method but surely in .Net there's such a
inbuilt method?

Thanks,
Adam

Apr 19 '06 #2
Under which LV event would this go?

Isn't it better to use the key rather than the name of the 1st column's
displayed text?

I need to link the LV to then allow some code that deletes an entry in an
INI file corresponding to the name of the LV item key.

Adam

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in message
news:OC**************@TK2MSFTNGP02.phx.gbl...
Hi Adam,

Try with the ListViewItem.Name property for the selected items.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> escribió en el
mensaje news:ug**************@TK2MSFTNGP03.phx.gbl...
Assuming lv.items.add(key,text, image index)

In a listview with items and subitems in each row, how do we
get the key value of the selected row?

The examples I see check for selectedindices it seems. In
VB6 I used a API method but surely in .Net there's such a
inbuilt method?

Thanks,
Adam


Apr 20 '06 #3
Hi Adam,

ListViewItem.Name returns the key that you used in the call
ListView1.Items.Add(key, text,....)

There is some incoherence because sometimes it is called Key, and sometimes
name. Do not confuse it with the text.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> escribió en el
mensaje news:O6**************@TK2MSFTNGP03.phx.gbl...
Under which LV event would this go?

Isn't it better to use the key rather than the name of the 1st column's
displayed text?

I need to link the LV to then allow some code that deletes an entry in an
INI file corresponding to the name of the LV item key.

Adam

Apr 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: keith | last post by:
In a ListView control (two columns), I added a few ListView items. ListView listview=new ListView(); listview.Parent=this; listview.View=View.Details; listview.Columns.Add...
1
by: juststarter | last post by:
hi, there is a vb.net listview (singleselect = true) control and when it loses the focus i want to keep the selecteditem highlighted i can use for example listView.selectedItems(0).backcolor =...
1
by: Alan T | last post by:
Is it possible to display 2 lines on a listview item ? In addition, I want to dispaly the second as hyperlink with color.
4
by: Pucca | last post by:
How can I tell a mouse right clicks over a listview item that's in a container panel. I only want to display a popup menu if the user right click the mouse over an item on the Listview. I don't...
1
by: apondu | last post by:
Hi, This is Govadhan, i am a begginer for web services using c#.net. I have written a small web service where in i have created a listview item in the web service method and added some data to...
2
by: Manfred | last post by:
Hello I try to add a listview item to the top of the list. I couldn't find the solution to this. After adding the item I like to remove the last item if a certain number of items is reached. ...
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
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a ListView in which each item is an array of 5 strings. I add these string arrays to the ListView by doing the following, where "result" is the array of 5 strings to add: ...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I would like to keep passwords in a ListView item but have them display as asterisks or som other arbitrary character. This is easy in a text box by settin the appropriate attribute but...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...

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.