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