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!"); } }