private void tbacc_Receipt_nAmount_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
e.Handled = true;
}
if (!char.IsControl(e.KeyChar))
{
TextBox textbox = (TextBox)sender;
if (textbox.Text.IndexOf('.') > -1 &&
textbox.Text.Substring(textbox.Text.IndexOf('.')).Length >= 3)
{
e.Handled = true;
}
}
}