storing a listview with subitems into string array??

P

Paul M

hi,

i have a listview which displays items with 2 subItems each.
How can i store these 3 items from each row into a string array?

currently i am storing only the first item, as below:

Public strFields As String()
For Each lv As ListViewItem In Me.lstFields.CheckedItems
tmpValues &= lv.Text & ";"
Next
strFields = Split(tmpValues, ";")

Can i add 2 more dimensions to this array so i can store subItem under
strFields(1,x) and subItem 2 under strFields(2,x)

Thanks,
Paul.
 
C

Cor

Hi Paul,
tmpValues &= lv.subitems(1).Text & ";"

If I was you I also would have a look to the "for index" method, that is
easier and than use an arraylist because that is also easier when you want
to archieve, what I supose you want.

I hope this helps?

Cor
 
P

Paul M

hi Cor,

i've had a quick look for some examples for this "For Index" method but cant
seem to find what you mean.

Could you please post a short code example if possible..?

thanks again,
Paul.
 
C

Cor

Hi Paul,

Very quick and dirty and absolute not complete and therefore pseudo
I do it with an array is even simpler to tell you, does not make a
difference in this case I realise me now.

dim ar(lstFields.CheckedItems.count) as string
dim i as integer
for i = 0 to Me.lstFields.CheckedItems.count - 1
ar(i) = me.lstfields.checkedItems(i).text &
lstfields.checkedItems(i).subitems(1).text
next

As I said only as an example.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top