| | |
How do i test if a user enter a letter in a textbox?
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Try this:
The numbers 48 to 57 are the ascii values of the numbers 0 to 9
more characters can be added.
i.e. 12,48 to 57,65,69 etc
Either single numbers or groups.
Pg
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 48 To 57 ' These are acceptable keystrokes Case Else ' These are unacceptable, and should be ignored KeyAscii = 0 End Select End Sub
The numbers 48 to 57 are the ascii values of the numbers 0 to 9
more characters can be added.
i.e. 12,48 to 57,65,69 etc
Either single numbers or groups.
Pg
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 48 To 57 ' These are acceptable keystrokes Case 8 Case Else ' These are unacceptable, and should be ignored KeyAscii = 0 End Select End Sub
![]() |
Similar Threads
- Change Focus in textbox (C#)
- Final project Visual Studio 2005 (C#)
- Validation function (Visual Basic 4 / 5 / 6)
- Login and retrieve user data from database (ASP.NET)
- Loop Program Wont work right..Help me please! (C)
- i want the user to enter an input without obligating him to press enter (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to create a database during the runtime in VB6?!
- Next Thread: Urgent need help!!!
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






