private void WeightInputTextBox_Leave(object sender, EventArgs e) { if (System.Text.RegularExpressions.Regex.IsMatch(WeightInputTextBox.Text, "[^0-9-(.)]")) { WeightInputTextBox.Focus(); MessageBox.Show("Weight should be number Only!"); } }
/// <summary> /// This method will clear all user input and selections /// </summary> private void ReturnToDefault() { HeightInputTextBox.Clear(); WeightInputTextBox.Clear(); BMI_ResultTextBox.Clear(); ResultMeaningTextBox.Clear(); _inchesInputTextBoxSelected = false; _weightInputTextBoxSelected = false; BMI_ResultTextBox.ReadOnly = true; CalculateButton.Enabled = false; }