/// <summary> /// This event handler will validate the text box input which it should be numbers only /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HeightInputTextBox_Leave(object sender, EventArgs e) { if (System.Text.RegularExpressions.Regex.IsMatch(HeightInputTextBox.Text, "[^0-9]")) { HeightInputTextBox.Focus(); MessageBox.Show("Height 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; }