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

Listview question

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
5 2188
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: andrewcw | last post by:
I have a simple winform with the following code. But although I can read back the info, the display fails to provide the text or the cell background color changes. private void ListViewBroke()...
1
by: J_Max | last post by:
Hello, This might be a really easy question, but... I am developing a simple Smart Device application that uses a listview. I have a function that adds a item to the listview - code is below. I...
7
by: Dave Y | last post by:
I am a newbie to C# and am having trouble trying to override a ListView property method. I have created a new class derived from the Forms.Listview and I cannot figure out the syntax to override...
3
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data,...
1
by: Derck | last post by:
SORRY, for the crosspost, but I think I posted it in the wrong group! Hello all, I have a question.. I am tying to make a global listview class where other listviews in my application points...
12
by: J L | last post by:
When I fill a listview, I resize the columns to fit the data. I need to know if the data will fit vertically or if there will be a vertical scroll bar. I need to know this so I can allow for it on...
1
by: Chris | last post by:
Hi all, I posted the following in microsoft.public.dotnet.framework.windowsforms but it seems that group has little traffic. Hi all, I have a listview box which is populated from methods of...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
1
by: =?Utf-8?B?THluYkBtcy5jb20=?= | last post by:
I have a executable winforms application I would like to change. I use quite a number of listview controls in my main form. I dump about 15 columns of data into a couple of listviews. This data...
5
by: Mark Olbert | last post by:
How do I get the DataPager and ListView to play nice together when I use a custom datasource? In my webpage, I use linq to pull data from a SqlServer database and assign the resulting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.