gridview中的cellendedit事件在另一个gridview中添加行?

时间:2014-02-25 10:59:50

标签: c# winforms datagridview

有2个DataGridview 和Cellendedit事件在第一个 我如何才能使这个事件在第二个DataGridview中添加行?

 DataGridViewTextBoxCell textBoxCell = new DataGridViewTextBoxCell();
                                textBoxCell.Value = itemDetails.First().UnitNameArabic;
                                dataGridView1.Rows[i].Cells[4].Value = itemDetails.First().SalePrice;
                                dataGridView1.Rows[i].Cells[1].Value = itemDetails.First().NameArabic;
                                dataGridView1.Rows[i].Cells[0].Value = itemDetails.First().Number;
                                dataGridView1.Rows[i].Cells[2] = textBoxCell;
                                DataGridViewRow row = new DataGridViewRow();
                                row.Cells[0].Value = itemDetails.First().NameArabic;
                                dataGridView2.Rows.Add(row);
                                dataGridView2.Refresh();

不使用第二个GridView

1 个答案:

答案 0 :(得分:0)

DataGridViewRow row2 = (DataGridViewRow)dataGridView2.Rows[i].Clone();