private void BtnAddComp_Click(object sender, EventArgs e) { AddComponent m = new AddComponent(0); try { m.btnAdd.Text = "Add New"; m.ShowDialog(); RefreshComp(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnUpComp_Click(object sender, EventArgs e) { if (dgvComponent.Rows.Count > 0) { var cmpID = Convert.ToInt32(dgvComponent.CurrentRow.Cells[0].Value); AddComponent m = new AddComponent(cmpID); m.txtDesign.Text = dgvComponent.CurrentRow.Cells[1].Value.ToString(); m.btnAdd.Text = "Update"; m.ShowDialog(); RefreshComp(); } else { MessageBox.Show("There is nothing to Update !!!", "Opration Failed", MessageBoxButtons.OK, icon: MessageBoxIcon.Error); } }