Retrieveing values from a listview

  • Thread starter Thread starter Eva
  • Start date Start date
E

Eva

hi,

can anyone tell me how i can retrieve specific values from
a listview?

i have created 6 columns that will contain values that are
added on an onclick event for a button. These values are
ontained from the user via textboxes, comboboxes etc.
 
In VB.NET:
ListView1.SelectedItems(0).SubItems(0).Text

In C#
ListView1.SelectedItems[0].SubItems[0].Text

In Cobol.NET
;-) Just kidding!

Is this what you are looking for?
 
Hi Jan,
will this return the entire row or just an individual item
in the listview.
what i want is to be able to select each one individually.
am i better off using a datagrid for this or is it just as
easy in a listview?

thx.
-----Original Message-----
In VB.NET:
ListView1.SelectedItems(0).SubItems(0).Text

In C#
ListView1.SelectedItems[0].SubItems[0].Text

In Cobol.NET
;-) Just kidding!

Is this what you are looking for?

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
Eva said:
hi,

can anyone tell me how i can retrieve specific values from
a listview?

i have created 6 columns that will contain values that are
added on an onclick event for a button. These values are
ontained from the user via textboxes, comboboxes etc.


.
 
ListView1.SelectedItems[0] will return the entire row.
ListView1.SelectedItems[0].SubItems[0].Text will return the value of the
first column.

The advantage of a DataGrid is that you can bind directly to your data
objects, in a ListView you have to create ListViewItems and add them to the
list.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
eva said:
Hi Jan,
will this return the entire row or just an individual item
in the listview.
what i want is to be able to select each one individually.
am i better off using a datagrid for this or is it just as
easy in a listview?

thx.
-----Original Message-----
In VB.NET:
ListView1.SelectedItems(0).SubItems(0).Text

In C#
ListView1.SelectedItems[0].SubItems[0].Text

In Cobol.NET
;-) Just kidding!

Is this what you are looking for?

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
Eva said:
hi,

can anyone tell me how i can retrieve specific values from
a listview?

i have created 6 columns that will contain values that are
added on an onclick event for a button. These values are
ontained from the user via textboxes, comboboxes etc.


.
 
Back
Top