Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All, I have two datagridview as 2 and 3, I just want to move selected row from 2nd datagridview to 3rd datagridview. Below is my cod segment, my problem is, I want to select selected row index value to here dataGridView2.Rows[??] and next available new row index value to here dataGridView3.Rows[??]. Please help me. Thanks for reading.
int n = dataGridView3.Rows.Add();
dataGridView3.Rows[0].Cells[0].Value = dataGridView2.Rows[0].Cells[0].Value;
dataGridView3.Rows[0].Cells[1].Value = dataGridView2.Rows[0].Cells[1].Value;
dataGridView3.Rows[0].Cells[2].Value = dataGridView2.Rows[0].Cells[2].Value;
Posted
Comments
DamithSL 17-Nov-14 5:08am    
dataGridView3.Rows.Add(dataGridView2.SelectedRows[0].ItemArray);
abdulsafran 17-Nov-14 5:17am    
Thanks for the reply DamithSL, how to create ItemArray to match with this incident?
Sinisa Hajnal 17-Nov-14 6:15am    
ItemArray is a property of DataRow, you don't have to create anything.
abdulsafran 17-Nov-14 7:42am    
Thanks both of your support

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