Listview question

  • Thread starter Thread starter the.dills
  • Start date Start date
T

the.dills

Hello all,

I need some help. I am using a listview to display the results of a
search. The dataset that I use to populate the control contain a
description and a record id. The record id is loaded as a subitem. When I
double-click on the entry I want to pass the id to another routine to
retrieve the record.

The problem is that the subitem contains more information than I load
from the dataset (just the record id [Long Integer]). When I attempt to use
CLng, .Net complains because it can't convert the value to a Long. Is there
another property value that I should be using to store the record id value?
I don't need to display this value to the users, so it doesn't have to be a
subitem. Help!!

Thanks in advance for any help you may provide.

Matt
 
the.dills said:
I need some help. I am using a listview to display the results of a
search. The dataset that I use to populate the control contain a
description and a record id. The record id is loaded as a subitem. When
I
double-click on the entry I want to pass the id to another routine to
retrieve the record.

The problem is that the subitem contains more information than I load
from the dataset (just the record id [Long Integer]). When I attempt to
use
CLng, .Net complains because it can't convert the value to a Long. Is
there
another property value that I should be using to store the record id
value?
I don't need to display this value to the users, so it doesn't have to be
a
subitem. Help!!

Hi Matt,

you can use the ListViewItem.Tag Property which gets or sets an object that
contains data to associate with the item.
http://msdn.microsoft.com/library/e...stemwindowsformslistviewitemclasstagtopic.asp

Cheers

Arne Janning
 
Thanks Arne.

It works just like I wanted. Thanks.

Matt

Arne Janning said:
the.dills said:
I need some help. I am using a listview to display the results of a
search. The dataset that I use to populate the control contain a
description and a record id. The record id is loaded as a subitem. When
I
double-click on the entry I want to pass the id to another routine to
retrieve the record.

The problem is that the subitem contains more information than I load
from the dataset (just the record id [Long Integer]). When I attempt to
use
CLng, .Net complains because it can't convert the value to a Long. Is
there
another property value that I should be using to store the record id
value?
I don't need to display this value to the users, so it doesn't have to be
a
subitem. Help!!

Hi Matt,

you can use the ListViewItem.Tag Property which gets or sets an object that
contains data to associate with the item.
http://msdn.microsoft.com/library/e...stemwindowsformslistviewitemclasstagtopic.asp

Cheers

Arne Janning
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top