Click here to Skip to main content
15,846,342 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Peeps,

Good Day!

I am a student studying Information Technology.

I have a total of 3 listviews.

ListView1 has 1 column.
ListView2 has 1 column.
ListVIew3 has 2 columns ( ListView1Column and ListView2Column combination).

How can I copy/clone the inputted data from ListView1 and/or ListView2 in ListView3?

Hoping for your assistance. Thanks.

What I have tried:

private void Button_Add_Click(object sender, EventArgs e)
{
     if (string.IsNullOrEmpty(TextBox1.Text))
          return;

     ListViewItem item = new ListViewItem(TextBox1.Text);
     ListView1.Items.Add(item);
     TextBox1.Clear();
     TextBox1.Focus();
}
Posted
Updated 23-Dec-21 1:09am
v2

If you get the DataSources of the ListView1 and ListView2 as DataTables then you can use this method to create a third datatable with the columns from each of the other two - Combining DataTables with Different Schema[^]

This might help with the first step convert listview.datasource to datatable - DotNetFunda.com[^]

You can then populate the ListView3 from the merged datatable - this might help Populate (Bind) ListView from Database in Windows Forms Application using C# and VB.Net[^]
 
Share this answer
 
I already gave you the answer at How to copy/clone in listview[^]. Please do not repost the same questions.
 
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