private void ProductView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { try { ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[0], SearchProduct.EditValue); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[1], SearchProduct.Text); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[2], searchUnit.EditValue); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[3], searchUnit.Text); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[4], spPrice.EditValue); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[5], spLength.EditValue); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[6], spWidth.EditValue); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[7], spQuantity.EditValue); // decimal TotalQuantity = (spLength.Value * spWidth.Value * spQuantity.Value); ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[8], TotalQuantity); // ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[9], spDiscount.Value); // decimal TotalLine = (spPrice.Value * TotalQuantity) - spDiscount.Value; ProductView.SetRowCellValue(e.RowHandle, ProductView.Columns[10], TotalLine); spInvoiceTotal.Value = spInvoicePaied.Value = spInvoiceTotal.Value + TotalLine; SpInvoiceDiscount.Value = SpInvoiceDiscount.Value + spDiscount.Value; } catch (Exception ex) { MessageBox.Show(ex.Message); } }