On Wed, 30 May 2007 10:51:07 -0700, <ka*******@hotmail.comwrote:
I tried both the above . e does not have a property called KeyCode
Sure it does, if you are actually handling the KeyDown event which has the
KeyEventArgs parameter:
http://msdn2.microsoft.com/en-us/lib...s.keycode.aspx
That said, it seems to me that Morton's advice about using the KeyPress
event instead is better. Set the e.Handled property to "true" to avoid
non-alphanumeric characters from being entered.
Also note that there's a MaskedTextBox that will do this sort of filtering
for you. If all you are trying to do is restrict input to alphanumerics,
that might be a better choice.
Pete