VB Code:
  1. Option Explicit
  2.  
  3. Private Sub Text1_KeyPress(KeyAscii As Integer)
  4.     If KeyAscii = vbKeyBack Then Exit Sub
  5.     If KeyAscii >= Asc("0") And _
  6.         KeyAscii <= Asc("9") Then Exit Sub
  7.        
  8.     KeyAscii = 0
  9. End Sub