siddiq shameer

siddiq shameer

  • NA
  • 44
  • 1.4k

transfering rows between datatables

Aug 19 2016 8:22 AM
  I have 2 datagridviews.  I need to transfer a single selected row from one to another
 
 I have used this code:-
  1. private void button4_Click(object sender, EventArgs e)  
  2.        {  
  3.            List<Object> TList = new List<object>();  
  4.            foreach(DataGridViewRow row in dataGridView1.SelectedRows)  
  5.            {  
  6.                TList.Add(row.DataBoundItem);  
  7.                dataGridView2.DataSource = TList;  
  8.            }  
  9.        } 
 it copies a single row from datagridview1 to datagridview2 .
but when i try to add another row , it replaces the current row in  datagridview2.
any solution??
 

Answers (4)