| | |
about keypress in keyascii
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Not completely sure what you exactly want.
Here is my code to disable some user input and enable other
Instead of keypress use keydown
Select Case KeyCode
Case 0 to 7
KeyCode = 0
Case Is = 8
KeyCode = KeyCode
Case 9 to 31
KeyCode = 0
Case 32 to 127
KeyCode = KeyCode
Case 128 to 255
KeyCode = 0
End Select
--or--
Better off putting it in a module so you can call it any time
-- start module--
Function DisEsc(KeyCode As Integer) As Integer
Select Case KeyCode
Case 0 to 7
DisEsc = 0
Case Is = 8
DisEsc = KeyCode
Case 9 to 31
DisEsc = 0
Case 32 to 127
DisEsc = KeyCode
Case 128 to 255
DisEsc = 0
End Select
--end module--
--Form Code--
Private Sub Form_KeyDown(KeyCode As Integer)
KeyCode = DisEsc(KeyCode)
End Sub
get your ascii values at http://www.asciitable.com/
Here is my code to disable some user input and enable other
Instead of keypress use keydown
Select Case KeyCode
Case 0 to 7
KeyCode = 0
Case Is = 8
KeyCode = KeyCode
Case 9 to 31
KeyCode = 0
Case 32 to 127
KeyCode = KeyCode
Case 128 to 255
KeyCode = 0
End Select
--or--
Better off putting it in a module so you can call it any time
-- start module--
Function DisEsc(KeyCode As Integer) As Integer
Select Case KeyCode
Case 0 to 7
DisEsc = 0
Case Is = 8
DisEsc = KeyCode
Case 9 to 31
DisEsc = 0
Case 32 to 127
DisEsc = KeyCode
Case 128 to 255
DisEsc = 0
End Select
--end module--
--Form Code--
Private Sub Form_KeyDown(KeyCode As Integer)
KeyCode = DisEsc(KeyCode)
End Sub
get your ascii values at http://www.asciitable.com/
Hi,
Change your code to :
Regards
Veena
Change your code to :
vb Syntax (Toggle Plain Text)
If KeyAscii <> 8 Then if keyascii >= 48 and keyascii <= 75 then exit sub else keyascii = 0 end if End If
Regards
Veena
![]() |
Similar Threads
- how to use the keypress function is visual basic 6 (Visual Basic 4 / 5 / 6)
- How do I validate a TAB event? (Visual Basic 4 / 5 / 6)
- how to use the keypress function is visual basic 6 (Visual Basic 4 / 5 / 6)
- Keypress Detection (C)
- How do I limit text char in Combo box? (VB.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Help with displaying random numbers
- Next Thread: Superscript Text in Name of TextBoxes, Lables & Buttons etc
| 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





