Home All Groups Group Topic Archive Search About

Capturing the second column data from a list view box.

Author
16 Aug 2006 5:00 AM
tneufeld@gmail.com
I am using a ListView control to display 2 columns of data that I
populate manually.   I can get the data in the first column easily
enough.  its when i try to get the data in the second column that I get
the problem.  I am just not sure where to start?  Is there a method
that lets me get this information easily?

TIM

Author
16 Aug 2006 6:33 AM
Cor Ligthert [MVP]
Tneufeld,

There is probably something wrong in your code.

It is really possible to populate the second column, however one of the
things you have of course to do is set the listview to detailview.

I think not that anybody can help you any further if you don't show how you
did it (and than only the relevant code).

I hope this helps,

Cor

<tneuf***@gmail.com> schreef in bericht
Show quoteHide quote
news:1155704437.451413.176810@h48g2000cwc.googlegroups.com...
>I am using a ListView control to display 2 columns of data that I
> populate manually.   I can get the data in the first column easily
> enough.  its when i try to get the data in the second column that I get
> the problem.  I am just not sure where to start?  Is there a method
> that lets me get this information easily?
>
> TIM
>
Author
16 Aug 2006 7:35 AM
tneufeld@gmail.com
I am not having a problem populating the second column.  but later on I
need to get say the data in the second column of a checked item.   that
is where I am hiaving the problems.  I can get the first column ok.  I
cant retrieve the information in the second column.

TIM
Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Tneufeld,
>
> There is probably something wrong in your code.
>
> It is really possible to populate the second column, however one of the
> things you have of course to do is set the listview to detailview.
>
> I think not that anybody can help you any further if you don't show how you
> did it (and than only the relevant code).
>
> I hope this helps,
>
> Cor
>
> <tneuf***@gmail.com> schreef in bericht
> news:1155704437.451413.176810@h48g2000cwc.googlegroups.com...
> >I am using a ListView control to display 2 columns of data that I
> > populate manually.   I can get the data in the first column easily
> > enough.  its when i try to get the data in the second column that I get
> > the problem.  I am just not sure where to start?  Is there a method
> > that lets me get this information easily?
> >
> > TIM
> >
Author
16 Aug 2006 10:42 AM
gene kelley
Show quote Hide quote
On 16 Aug 2006 00:35:42 -0700, "tneuf***@gmail.com" <tneuf***@gmail.com> wrote:

>I am not having a problem populating the second column.  but later on I
>need to get say the data in the second column of a checked item.   that
>is where I am hiaving the problems.  I can get the first column ok.  I
>cant retrieve the information in the second column.
>
>TIM
>Cor Ligthert [MVP] wrote:
>> Tneufeld,
>>
>> There is probably something wrong in your code.
>>
>> It is really possible to populate the second column, however one of the
>> things you have of course to do is set the listview to detailview.
>>
>> I think not that anybody can help you any further if you don't show how you
>> did it (and than only the relevant code).
>>
>> I hope this helps,
>>
>> Cor
>>
>> <tneuf***@gmail.com> schreef in bericht
>> news:1155704437.451413.176810@h48g2000cwc.googlegroups.com...
>> >I am using a ListView control to display 2 columns of data that I
>> > populate manually.   I can get the data in the first column easily
>> > enough.  its when i try to get the data in the second column that I get
>> > the problem.  I am just not sure where to start?  Is there a method
>> > that lets me get this information easily?
>> >
>> > TIM
>> >

(VB2005)

If two columns then the second column item would be subitems(1):

   Private Sub ListView1_ItemChecked(ByVal sender As Object, _
     ByVal e As System.Windows.Forms.ItemCheckedEventArgs) _
     Handles ListView1.ItemChecked
        Me.Label1.Text = e.Item.SubItems(1).Text
    End Sub

Gene
Author
8 Sep 2006 1:44 AM
tneufeld@gmail.com
That doesnt seem to work.  I am trying to get the subitem, but not
within any of the controls own routines.  here is the code I have so
far.


            For i = 0 To .lvAllItems.CheckedItems.Count - 1

                If .lvAllItems.Items.Item(i).Selected Then

                    textbox1.text = txtProfileName & "," &
..lvAllItems.Items.Item(i).ToString & "," &
..lvAllItems.Items(i).SubItems


                End If
            Next


gene kelley wrote:
Show quoteHide quote
> On 16 Aug 2006 00:35:42 -0700, "tneuf***@gmail.com" <tneuf***@gmail.com> wrote:
>
> >I am not having a problem populating the second column.  but later on I
> >need to get say the data in the second column of a checked item.   that
> >is where I am hiaving the problems.  I can get the first column ok.  I
> >cant retrieve the information in the second column.
> >
> >TIM
> >Cor Ligthert [MVP] wrote:
> >> Tneufeld,
> >>
> >> There is probably something wrong in your code.
> >>
> >> It is really possible to populate the second column, however one of the
> >> things you have of course to do is set the listview to detailview.
> >>
> >> I think not that anybody can help you any further if you don't show how you
> >> did it (and than only the relevant code).
> >>
> >> I hope this helps,
> >>
> >> Cor
> >>
> >> <tneuf***@gmail.com> schreef in bericht
> >> news:1155704437.451413.176810@h48g2000cwc.googlegroups.com...
> >> >I am using a ListView control to display 2 columns of data that I
> >> > populate manually.   I can get the data in the first column easily
> >> > enough.  its when i try to get the data in the second column that I get
> >> > the problem.  I am just not sure where to start?  Is there a method
> >> > that lets me get this information easily?
> >> >
> >> > TIM
> >> >
>
> (VB2005)
>
> If two columns then the second column item would be subitems(1):
>
>    Private Sub ListView1_ItemChecked(ByVal sender As Object, _
>      ByVal e As System.Windows.Forms.ItemCheckedEventArgs) _
>      Handles ListView1.ItemChecked
>         Me.Label1.Text = e.Item.SubItems(1).Text
>     End Sub
>
> Gene