僅允許數目字的輸入-- 修改自璉璉的 code(編號:746)

Private Sub txtTimes_KeyPress(KeyAscii As Integer)
KeyAscii = KeyOnlyNumber(KeyAscii)
End Sub
' 撰寫人:Devil(璉璉) E-Mail: qvb3377@ms5.hinet.net 僅供學術測試使用,引用請註明原出處
' 修改人:Edward 2000/01/12,僅允許數目字,方向鍵與倒退鍵
'--------------------------------------------------------------------------------------
Public Function KeyOnlyNumber(ByVal KeyAscii As Integer) As Integer
Select Case KeyAscii
  Case 48 To 57 ' 0~9
  Case Is = 8, 13 ' 不變
  Case Else
    KeyAscii = 0
  End Select
  KeyOnlyNumber = KeyAscii
End Function