Decimal validation mostly used utility in the software application ..........
The Below sample code is done the numeric validation exactly.it doesn't allow the double dot in numeric values...........
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
NumericDecimalValidation(sender,e);
}
{
if (char.IsDigit(e.KeyChar) || e.KeyChar.ToString() == "." || char.IsControl(e.KeyChar))
{
if (((TextBox)Sender).Text.IndexOf(".") != -1 && e.KeyChar.ToString() == ".")
e.Handled = true;
else
e.Handled = false;
}
else
e.Handled = true;
}
0 comments :
Post a Comment