VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic

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.

Rate Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic




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.

Download this snippet    Add to My Saved Code

Prevent the user from typing data int a text box. This code works with ALL versions of Visual Basic Comments

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.

Post your comment

Subject:
Message:
0/1000 characters