This is what I want to do:
but e.KeyChar can't be assigned to bc it's readonly.Code:if (!Char.IsDigit(e.KeyChar.ToString(), 0) )
{
STOPTHISCHARFROMBEINGENTERED();
}
Help?
Dan
Printable View
This is what I want to do:
but e.KeyChar can't be assigned to bc it's readonly.Code:if (!Char.IsDigit(e.KeyChar.ToString(), 0) )
{
STOPTHISCHARFROMBEINGENTERED();
}
Help?
Dan
Quote:
Originally Posted by dipique
Simply use e.Handled=true
Dan :eek:Code:private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar.ToString(), 0) )
{
e.Handled=true;
}
}
My username elsware is datique which is very similar to you. We are not long lost brothers are we. Lol
Thanks, that worked wonderfully. As to whether we are long lost brothers... well, I suppose it's possible. But probably not ;)