listview

  • Thread starter Thread starter Jan
  • Start date Start date
J

Jan

How can a place the contents of a listview into an array inc. the subitems.

newbee question

thx very much
 
Hi Jan,

An array is not the best thing to put in listviewItems

A array is two dimensial
a table of rows with one item

A listview 3 dimensial
a table of rows which has columns which has items

I would use a datatable for that, others make there own collection I think.

a datatable goes like this (rough typed watch typos)

\\\
dim dt as new datatable
dim dc1 as new datacolumn
dim dc2 as new datacolumn
dt.columns.add(dc1)
dt.columns.add(dc2).
dim lvi as listviewitem
for each lvi in mylistview.items
dim dr as datarow = dt.newrow
dr.item(0) = lvi.subitem(1).text
dr.item(1) = lvi.subitem(2).text
dt.rows.add(dr)
next
///

I hope this helps a little bit?

Cor



Cor
 
* Jan said:
ListViewItems to a string

I don't think that there is an easier way than looping through the items
and their subitems and adding them to an array or arraylist.
 
Hi Jan,

An array is not the best thing to put in listviewItems

A array is two dimensial
a table of rows with one item

A listview 3 dimensial
a table of rows which has columns which has items

I would use a datatable for that, others make there own collection I think.

a datatable goes like this (rough typed watch typos)

\\\
dim dt as new datatable
dim dc1 as new datacolumn
dim dc2 as new datacolumn
dt.columns.add(dc1)
dt.columns.add(dc2).
dim lvi as listviewitem
for each lvi in mylistview.items
dim dr as datarow = dt.newrow
dr.item(0) = lvi.subitem(1).text
dr.item(1) = lvi.subitem(2).text
dt.rows.add(dr)
next
///

I hope this helps a little bit?

Cor



Cor

Thx, this tip helped
 
Back
Top