private void AddOfferingBtn_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(amountTxt.Text) || givingTypesCmbBx.SelectedIndex < 0) { return; } double parsed; if (!double.TryParse(amountTxt.Text, out parsed)) { MessageBox.Show("Invalid amount input! Amount must be a numerical data", "Invalid Input"); amountTxt.Focus(); amountTxt.SelectionStart = 0; amountTxt.SelectionLength = amountTxt.Text.Length; return; } if (isUpdate) { givingItem.Update(giving, new GivingTypesController().Show((int)givingTypesCmbBx.SelectedValue), Convert.ToDouble(amountTxt.Text), noteTxt.Text); } else { new GivingItem(giving, new GivingTypesController().Show((int)givingTypesCmbBx.SelectedValue), Convert.ToDouble(amountTxt.Text), noteTxt.Text); } this.Close(); }