/// <summary>
/// 判断是否输入的是数字allyn
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtAllPrice_KeyPress(object sender, KeyPressEventArgs e)
{
char bb = e.KeyChar;
getMethod(bb,e);
}
public void getMethod(char KeyChar, KeyPressEventArgs e)
{
if ((Convert.ToInt32(KeyChar) == 8))
{
e.Handled = false;
}
else
{
Regex numRegex = new Regex(@"^(-?[0-9]*[.]*[0-9]*)$");
Match Result = numRegex.Match(Convert.ToString(KeyChar));
if (Result.Success)
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
}