private void UpdateButton_Click(object sender, EventArgs e) { UpdateDocumentForm formUpD = new UpdateDocumentForm(this); try { if (MainDataGrid.SelectedCells.Count > 0) { int selectedRowIndex = MainDataGrid.SelectedCells[0].RowIndex; SelectedRow = MainDataGrid.Rows[selectedRowIndex]; int Id = Convert.ToInt32(SelectedRow.Cells["DocumentID"].Value); string name = Convert.ToString(SelectedRow.Cells["Nazwa"].Value); DateTime date = Convert.ToDateTime(SelectedRow.Cells["Data"].Value); string nrKlienta = Convert.ToString(SelectedRow.Cells["NumerKlienta"].Value); string cenaNetto = Convert.ToString(SelectedRow.Cells["CenaNetto"].Value); string cenaBrutto = Convert.ToString(SelectedRow.Cells["CenaBrutto"].Value); formUpD.DeliverInfoHeaderUpD(name, date, nrKlienta, cenaNetto, cenaBrutto); formUpD.FillUpdateProductDetailGrid(Id); formUpD.DocId = Id; formUpD.Show(); FillGrid(); } } catch { MessageBox.Show("Nie zaznaczono żadnego dokumentu", "Błąd", 0); } }
public AddProductForm(UpdateDocumentForm formU) { InitializeComponent(); updateForm = formU; }