Capturing the second column data from a list view box.

  • Thread starter Thread starter tneufeld
  • Start date Start date
T

tneufeld

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
 
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
 
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.
 
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.

(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
 
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
 
Back
Top