by Chris Bassett (Wintools) ([email protected]) (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sun 2nd September 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic, including 1.0 for DOS.
KeyAscii = 0
'Like this:
Sub Textbox1_KeyPress(KeyAscii as Integer)
KeyAscii = 0
End Sub
'''------
'This will tell program that whenever a key is pressed while the textbox has
'the focus, do not allow the program to change the value of the textbox
'contents.
'I am aware that in VB4+ there is a Locked property for textboxes which
'does the same thing, but this works in any version of VB.
No comments have been posted about Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic. Why not be the first to post a comment about Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic.