I have two forms Form1(DGV1) and Form2(DGV2) with Datagridview control on both the forms.
On Form1 there is a button link to Form2 where user can add rows to Form1 datagridview(DGV1)
..In Form2 Datagridview there is a checkbox in the first column and the user can select only one row at a time.So there are two button on Form2 1) Done 2) Add Items
When user clicks on Add Items by selecting the rows one after another the rows must be added to the datagridview on Form1 and when Done button is clicked Form 1 should be displayed with all the rows that are added.
int index = objQM.gvItemDetails.Rows.Add();
int Sno = index + 1;
string Desc = gvInventory.Rows[RowIndex].Cells.Value.ToString();
int Sellqty = LoadSellQty();
decimal UnitCost = Convert.ToDecimal(gvInventory.Rows[RowIndex].Cells.Value.ToString());
decimal Amount = LoadSellQty() * UnitCost;
objQM.gvItemDetails.Rows.Insert(index,false, Sno, Desc, Sellqty, UnitCost, Amount);
I am able to add one row into Form1 datagridview but when the second row is added the row which was added earlier is lost.
Can you please suggest a way to solve this.