2

have 2 DataGridview and Cellendedit event in first one how i can make this event add row in the second 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();

Not working with second GridView

Kurubaran
  • 8,696
  • 5
  • 43
  • 65
  • Possible duplicate: http://stackoverflow.com/questions/10063770/c-sharp-how-to-add-a-new-row-to-datagridview-programmatically – Dmitry Feb 25 '14 at 11:32
  • in `dataGridView1_CellEndEdit` event add row in second datagridview is wrok correctly. what kind of error you get it – Sathish Feb 25 '14 at 11:36
  • Your code should work fine. There must be something else interrupting. You don't need the `Refresh()` call. Please provide more relevant code. – etaiso Feb 25 '14 at 11:40
  • What do you mean by not working? Are you getting an error or exception? – Junaith Feb 25 '14 at 14:16
  • no , nothing effect in grideview2 –  Feb 25 '14 at 14:18

1 Answers1

0
DataGridViewRow row2 = (DataGridViewRow)dataGridView2.Rows[i].Clone();
SOFKiNG
  • 385
  • 1
  • 3
  • 20