private void BtnAddExp_Click(object sender, EventArgs e) { AddExpence m = new AddExpence(0, usrID); try { m.btnAdd.Text = "Add New"; m.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } //refresh DataGridView RefreshDgvExpence(); }
private void BtnUpdExp_Click(object sender, EventArgs e) { if (dgvExpence.Rows.Count > 0) { var expenceId = Convert.ToInt32(dgvExpence.CurrentRow.Cells[0].Value); AddExpence m = new AddExpence(expenceId, usrID); m.txtPaymnt.Text = dgvExpence.CurrentRow.Cells[2].Value.ToString(); m.txtDescrip.Text = dgvExpence.CurrentRow.Cells[5].Value.ToString(); m.dwnCategories.SelectedItem(dgvExpence.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); } RefreshDgvExpence(); }