Click here to Skip to main content
15,889,699 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Day!!

First Of All I would like to thanks in this forum for the opportunity to ask for help regarding C#
I have a problem, i hope someone can clear my mind what i wanted

and also im trying to learn C# language now.

the situation is like this

I have 3 listview namely listView1, listView2, listView3

I have dynamic data on listView1 and listView2

listView1 has 3 ColumnHeader,

listView2 has 2 ColumnHeader

while listView3 has 5 ColumnHeader

now, i want that the first, second and third ColumnHeader of listview1
will be copied to the first , second and third ColumnHeader of listView3

and the first and second ColumnHeader of listView2
will be copied to the fourth and fifth ColumnHeader of listView3

is it possible???
can someone help me this??
i do have this code to copy data from listView1 to listView3 but it doesn't help what i needed, it just copied the listView1 to listView3.


C#
listView3.Items.AddRange((from ListViewItem item in listView1.Items
                               select (ListViewItem)item.Clone()
                                ).ToArray());



Can someone enlighten me how to derive on what i needed....
thanks
Posted
Updated 21-Jun-19 0:22am

1 solution

For Copy ListView Columns to another Listview :


listView3.Columns.AddRange((from ColumnHeader Col in listview1.Columns
                                          select (ColumnHeader)Col.Clone()).ToArray());
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900