private void inputBox_ValidatingFloat(object sender, InputBoxValidatingArgs e) { if (e.Text.Trim().Length == 0) { e.Cancel = true; e.Message = "Required"; } float f; if (!Single.TryParse(e.Text, out f)) { e.Cancel = true; e.Message = "Must be a number. Decimals are allowed."; } }
private void inputBox_ValidatingSection(object sender, InputBoxValidatingArgs e) { if (e.Text.Trim().Length == 0) { e.Cancel = true; e.Message = "Required"; } if (!currentWeights.ContainsKey(e.Text)) { e.Cancel = true; e.Message = "The specified section name does not exist."; } }
private void inputBox_Validating(object sender, InputBoxValidatingArgs e) { if (e.Text.Trim().Length == 0) { e.Cancel = true; e.Message = "Required"; } }
/// <summary> /// Validate the Text using the Validator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBoxText_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if (Validator != null) { InputBoxValidatingArgs args = new InputBoxValidatingArgs(); args.Text = textBoxText.Text; Validator(this, args); if (args.Cancel) { e.Cancel = true; errorProviderText.SetError(textBoxText, args.Message); } } }