c# - ListView AddRange of Items starting from SubItem[1] -
i have listview has populated first column.
can use :
mylistview.items.addrange(new listviewitem[] { item })
but since have first column populated, tried using:
mylistview.items[0].subitems.addrange(new listviewitem[] { item })
but error:
i can use string[]
overload, there way use listviewitem[]
instead subitems?
here's code:
listviewitem item = new listviewitem(new string[] { exp[listbox1.selectedindex].tostring(), exp2[listbox1.selectedindex].tostring() }); listview2.items[0].subitems.addrange(new listviewitem[] { item });
so why don't do:
listview2.items[0].subitems .addrange(new [] { exp[listbox1.selectedindex].tostring(), exp2[listbox1.selectedindex].tostring(), });
the method expects either array of strings
or listviewsubitems
.
Comments
Post a Comment