private async void btnSave_Click(object sender, EventArgs e) { if (txtInterest.Text == "" || cboPaymentTerm.SelectedIndex == -1) { MetroFramework.MetroMessageBox.Show(this, "Warning! Interest rate must have a value.", "Interest", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsNumeric(txtInterest.Text)) { MetroFramework.MetroMessageBox.Show(this, "Warning! Interest rate must be a number.", "Interest", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (double.Parse(txtInterest.Text) <= 0) { MetroFramework.MetroMessageBox.Show(this, "Warning! Interest rate must have a valid value not 0 or negative.", "Interest", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } decimal rate = Convert.ToDecimal(txtInterest.Text); int id = int.Parse(cboPaymentTerm.SelectedValue.ToString()); if (await interests.Update(rate, id)) { MetroFramework.MetroMessageBox.Show(this, interests.msg, "Interest", MessageBoxButtons.OK, MessageBoxIcon.Question); } else { MetroFramework.MetroMessageBox.Show(this, interests.msg, "Interest", MessageBoxButtons.OK, MessageBoxIcon.Error); } }