nazim corakli nazim corakli - 1 year ago 86
C# Question

Different listview columns copy error

I have 2 listviews:

  • listview1 has 5 columns (0, 1, 2, 3, 4)

  • listview2 has 20 columns (0, 1, 2,.., 18, 19)

I want to copy items from listview1 to listview2.

Then I have to write something


but I cannot write. There is no columns here. But listview1 has 20 columns.

Anybody knows this problem's solution?

(I have to use copy function. I cannot move items one by one.)

Answer Source

Just because the listview has 20 columns, doesn't mean that every item has 19 subitems. You still have to use the .Add or .AddRange method to give value to all the possible subitems.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download