Hi Chris,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add rows from one DataGrid
to the other. If there is any misunderstanding, please feel free to let me
know.
Generally, when we need to add rows from one DataGrid to the other, we have
to add rows in the source DataSet. Here is an example. when you click a row
on one DataGrid, that row will be added to the other DataGrid.
private void Form1_Load(object sender, System.EventArgs e)
{
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Employees",
this.sqlConnection1);
this.ds1 = new DataSet();
this.ds2 = new DataSet();
sda.FillSchema(ds1, SchemaType.Source);
sda.FillSchema(ds2, SchemaType.Source);
sda.Fill(ds1);
this.dataGrid1.DataSource = ds1.Tables[0];
this.dataGrid2.DataSource = ds2.Tables[0];
cm = (CurrencyManager)this.BindingContext[this.ds1.Tables[0]];
cm.CurrentChanged +=new EventHandler(cm_CurrentChanged);
}
private void cm_CurrentChanged(object sender, EventArgs e)
{
this.ds2.Tables[0].Rows.Add(this.ds1.Tables[0].Rows[this.cm.Position].ItemAr
ray);
}
HTH. If anything is unclear, please feel free to reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."