In Visual Basic 6; Under the KeyPressEvent of a textbox:

VB Code:
  1. Select Case KeyAscii
  2.  
  3. Case vbKey0 To vbKey9
  4.  
  5. KeyAscii = KeyAscii
  6.  
  7. Case Else
  8.  
  9. KeyAscii = 0
  10.  
  11. End Select

In C#????

e.KeyChar is read only

Any ideas?

thx!