EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB 6 Textbox Only Numeric Textboxes

Only Numeric Textboxes

E-mail Print

Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer

Select Case KeyAscii
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0
Case 45 And InStr(TextBox, "-") = 0

If TextBox.SelStart > 0 Then
KeyAscii = 0
End If
Case Else

KeyAscii = 0

End Select
OnlyNumericKeys = KeyAscii

End Function

Last Updated on Tuesday, 27 September 2011 23:11