日期:2014-05-17 浏览次数:20760 次
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar < '0'
------解决方案--------------------
e.KeyChar > '9') && e.KeyChar != 8 && e.KeyChar != '.')
e.Handled = true;
else if (e.KeyChar == '.')
{
if (((TextBox)sender).Text.LastIndexOf('.') != -1)
{
e.Handled = true;
}
}
}