private void button1_Click(object sender, EventArgs e) { AddEditProduct f = new AddEditProduct(); var res = f.ShowDialog(); if (res == DialogResult.OK) { ProductsForm_Load(null, null); } }
private void button2_Click(object sender, EventArgs e) { if (productsDataGridView.SelectedCells.Count != 1) { MessageBox.Show("Choose the one row to edit !"); return; } var row = productsDataGridView.SelectedCells[0]; int RowIndex = ((System.Windows.Forms.DataGridViewTextBoxCell)row).RowIndex; int sID = (int)productsDataGridView[0, RowIndex].Value; AddEditProduct f = new AddEditProduct(sID.ToString()); var res = f.ShowDialog(); if (res == DialogResult.OK) { ProductsForm_Load(null, null); } }