VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple code allows print into the TextBox numbers only.

by Dr. Dre (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 9th June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple code allows print into the TextBox numbers only.

API Declarations



Public Sub NUMBERS_ONLY(KeyAscii As Integer, TXT As TextBox)
Select Case KeyAscii
'negotive numbers
'KeyAscii; 45 is "-"
Case 45
If Len(TXT.Text) >= 1 Then
KeyAscii = 0
End If
'KeyAscii; 8 is "Backspace", 46 is "." decimal,
' 48-57 is "0-9"
Case 8, 46, 48 To 57
KeyAscii = KeyAscii
Case Else
KeyAscii = 0
End Select
End Sub


Rate Simple code allows print into the TextBox numbers only.



'on KeyPress event:

Private Sub Text1_KeyPress(KeyAscii As Integer)
    NUMBERS_ONLY KeyAscii, Text1
End Sub


Download this snippet    Add to My Saved Code

Simple code allows print into the TextBox numbers only. Comments

No comments have been posted about Simple code allows print into the TextBox numbers only.. Why not be the first to post a comment about Simple code allows print into the TextBox numbers only..

Post your comment

Subject:
Message:
0/1000 characters