Here is part of code:
private void load_lv() {
lv_ss.Items.Clear();
lv_ss.Items.Add(supp.lv_standstill((optionsloaded) ? cbx_options.SelectedIndex : 0));
}
lv_ss
is a Listview.
I want to add items to lv_ss
using another method:
Here is another part of the code:
public ListViewItem lv_standstill(int option) {
string[] row = new string[6];
ListViewItem lv_item = new ListViewItem();
//not important part of code
//loading data from sql etc to row[]
if (first) {
lv_item = new ListViewItem(row);
first = false;
} else {
lv_item.SubItems.AddRange(row);
}
}
return lv_item;
}
Every new item of lv_item
contains a row.
The problem is to move all ROWS to lv_ss
listview.
When I use lv_ss.Items.Add
it puts only first row.
I've tried with ListViewItem.ListViewSubItemCollection
.. and then foreach
subitem.
But it reads a single string from a row, not a whole row.
Not sure how to do that.
I mean, of course, I can put whole code in -> private void load_lv(){}
But I'm stubborn :D
Any help or ideas?