|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Listview questionHi 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,
A listview is not a datatable (dataview). A listview has headers but AFAIK no column names, Cor Show quoteHide quote "Kay" <k*@kk.com.kk> schreef in bericht news:eH3wUuZxGHA.3788@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 > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:eXPUXgaxGHA.4968@TK2MSFTNGP03.phx.gbl... > Kay, > > A listview is not a datatable (dataview). > A listview has headers but AFAIK no column names, > > Cor > > "Kay" <k*@kk.com.kk> schreef in bericht > news:eH3wUuZxGHA.3788@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 >> > > 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 Show quoteHide quote "Kay" <k*@kk.com.kk> schreef in bericht news:ej0%230AbxGHA.5064@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]" <notmyfirstn***@planet.nl> wrote in message > news:eXPUXgaxGHA.4968@TK2MSFTNGP03.phx.gbl... >> Kay, >> >> A listview is not a datatable (dataview). >> A listview has headers but AFAIK no column names, >> >> Cor >> >> "Kay" <k*@kk.com.kk> schreef in bericht >> news:eH3wUuZxGHA.3788@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 >>> >> >> > >
Show quote
Hide quote
On Tue, 22 Aug 2006 13:34:58 +1000, "Kay" <k*@kk.com.kk> wrote: The DataGridView control, unbound, can be configured to look indentical to a ListView, Detail View,>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 > and will give you the functionality you are looking for. Gene Kay wrote:
> Hi all, Kay,> > 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 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").Text I hope this helps. -- Al Reid |
|||||||||||||||||||||||