By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Listview question

P: n/a
Kay
Hi all,

I know that I can get the value of a particualar column in a list view by
something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net you can
assign a column name for each column, but I don't know where I can use
it.... any idea?

Thx~~~

Kay
Aug 22 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Kay,

A listview is not a datatable (dataview).
A listview has headers but AFAIK no column names,

Cor

"Kay" <kk@kk.com.kkschreef in bericht
news:eH**************@TK2MSFTNGP02.phx.gbl...
Hi all,

I know that I can get the value of a particualar column in a list view by
something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net you
can assign a column name for each column, but I don't know where I can use
it.... any idea?

Thx~~~

Kay

Aug 22 '06 #2

P: n/a
Kay
It has Cor...in a listview's property, it has a "columns" collection, in
each column you can assign a name there, it also where you can assign the
column Text.... am I correct?

Kay
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:eX**************@TK2MSFTNGP03.phx.gbl...
Kay,

A listview is not a datatable (dataview).
A listview has headers but AFAIK no column names,

Cor

"Kay" <kk@kk.com.kkschreef in bericht
news:eH**************@TK2MSFTNGP02.phx.gbl...
>Hi all,

I know that I can get the value of a particualar column in a list view by
something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net you
can assign a column name for each column, but I don't know where I can
use it.... any idea?

Thx~~~

Kay


Aug 22 '06 #3

P: n/a
Kay,

But AFAIK does by instance a datatable column describe a datarow item.
(Therefore you cannot simple move a datarow to another datatable).

A listview column describes only a header column not a
listviewitemcollection item.

Cor

"Kay" <kk@kk.com.kkschreef in bericht
news:ej****************@TK2MSFTNGP04.phx.gbl...
It has Cor...in a listview's property, it has a "columns" collection, in
each column you can assign a name there, it also where you can assign the
column Text.... am I correct?

Kay
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:eX**************@TK2MSFTNGP03.phx.gbl...
>Kay,

A listview is not a datatable (dataview).
A listview has headers but AFAIK no column names,

Cor

"Kay" <kk@kk.com.kkschreef in bericht
news:eH**************@TK2MSFTNGP02.phx.gbl...
>>Hi all,

I know that I can get the value of a particualar column in a list view
by something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net you
can assign a column name for each column, but I don't know where I can
use it.... any idea?

Thx~~~

Kay



Aug 22 '06 #4

P: n/a
On Tue, 22 Aug 2006 13:34:58 +1000, "Kay" <kk@kk.com.kkwrote:
>Hi all,

I know that I can get the value of a particualar column in a list view by
something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net you can
assign a column name for each column, but I don't know where I can use
it.... any idea?

Thx~~~

Kay
The DataGridView control, unbound, can be configured to look indentical to a ListView, Detail View,
and will give you the functionality you are looking for.

Gene
Aug 22 '06 #5

P: n/a
Kay wrote:
Hi all,

I know that I can get the value of a particualar column in a list
view by something like this:
lvwRoster.SelectedItems(0).SubItems(2).Text

However, is it possible to get the value by column name? In vb.net
you can assign a column name for each column, but I don't know where
I can use it.... any idea?

Thx~~~

Kay
Kay,

If you set the Name property on the ListViewItem and the ListViewSubItems as you add them into the ListView you can then access the
columns by name. For example, if you set the ListViewItem.Name to "FirstName" then you can access the column as:

lvwRoster.SelectedItems(0).SubItems("FirstName").T ext

I hope this helps.

--
Al Reid
Aug 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.