private void textBoxHours_TextChanged(object sender, EventArgs e) { bool applicable = (!IsNotApplicableString(textBoxHours.Text) && textBoxHours.Text != ""); if (applicable) { try { Hours = Lifelength.ParseHours(textBoxHours.Text); } catch (Exception ex) { return; } } HoursApplicable = applicable; }
private bool ValidateHours() { if (readOnly) { return(true); } string text = textBoxHours.Text; if (!IsNotApplicableString(text)) { try { TimeSpan value = Lifelength.ParseHours(text); } catch { MessageBox.Show("Invalid value for hours parameter", new TermsProvider()["SystemName"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } return(true); }