Click here to Skip to main content
15,748,930 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using 2 forms having both of them having separate datagrid. i
did't bound any datagrid to any datasource but i just added some rows to one datagrid and want to copy it to other form datagrid using the code

RegistrationForm rg = new RegistrationForm(); 
for (int i = 0; i < this.dataGridView2.Rows.Count-1; i++)  
string[] values = { this.dataGridView2.Rows[i].Cells  ["TestID"].Value.ToString(), this.dataGridView2.Rows[i].Cells["TestName"].Value.ToString(), this.dataGridView2.Rows[i].Cells["Charges"].Value.ToString(), this.dataGridView2.Rows[i].Cells["DeliveryDate"].Value.ToString() ;
 rg .dataGridView1.Rows.Add(values);//dataGridView is on an other form

this code shows in debuger that the data is copied but in the datagrid it not displys.
why ?
any sugistion or any alternate code pleas.
Updated 29-Jun-10 22:02pm

1 solution

Why don't you create a datasource and bind that with the DataGridView present in a different form instead of adding rows?
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