private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
bool IsDec = false;
if (e.KeyChar >= 48 && e.KeyChar <= 57 || e.KeyChar == 8)
{
e.Handled = false;
}
else
{
if (e.KeyChar == 46)
{
e.Handled = (IsDec) ? true : false;
}
else
{
e.Handled = true;
}
}
}