//判断是不是输入的数字 private void IsNumeric(string str) { System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding(); byte[] bytestr = ascii.GetBytes(str); foreach (byte c in bytestr) { if (c < 48 || c > 57) { MessageBox.Show("罚款金额您输入的不是数字!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }