private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { DataGridView senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0) { string productCode = gv.Rows[e.RowIndex].Cells[1].Value.ToString(); DateTime startDate = (DateTime)gv.Rows[e.RowIndex].Cells[3].Value; switch (senderGrid.Columns[e.ColumnIndex].Name) { case "Edit": var frm = new Form_ProductPriceAddEdit { productCode = productCode, startDate = startDate }; if (frm.ShowDialog() == DialogResult.OK) { LoadOrder(); } break; case "Print": break; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnAdd_Click(object sender, System.EventArgs e) { var frm = new Form_ProductPriceAddEdit(); if (frm.ShowDialog() == DialogResult.OK) { LoadOrder(); } }