private void btnsave_Click(object sender, EventArgs e) { int branch_id = -1; if (this.txt_branch_name.Text == string.Empty) { MessageBox.Show("Bank branch is a required field", "Accounts info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (this.txt_branch_id.Text != string.Empty) { branch_id = Convert.ToInt32(this.txt_branch_id.Text); } Salary_scales.save_update_branch_details("save_update_branch_details", this.txt_branch_name.Text, (this.chk_active.Checked ? true : false), branch_id); MessageBox.Show("Success", "Accounts info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.get_bank_branches(); }