Home > Net >  How will the dataGridView1 controls the selected rows to dataGridView2 copy
How will the dataGridView1 controls the selected rows to dataGridView2 copy

Time:03-02

Use the following code is not able to realize, somehow?

Foreach (DataGridViewRow r in dataGridView1. SelectedRows)
{
if (! R.I sNewRow)
{
DataGridView2. Rows. The Add (r);
}
}

CodePudding user response:

Then using the method of array can be involved in another way to obtain an array of values to do processing

CodePudding user response:

Should add 1 data to the binding of 2 data sources.

CodePudding user response:

If the memory table DTT is bound to the dataGridView2, such as: dataGridView2. The DataSource=DTT;
Then copies in dataGridView1 controls the selected rows to dataGridView2, use the following statement, still won't do,
Foreach (DataGridViewRow r in dataGridView1. SelectedRows)
{
if (! R.I sNewRow)
{
DTT. Rows. The Add (r);
}
}
  •  Tags:  
  • C#
  • Related