Two text boxes in VB

zhaozj2021-02-16  64

The text box in VB is used very frequently in the development. Here is two tips, share with you:

1. How to limit the text box can only enter the number key? Code: Private Sub Text1_KeyPress (Keyascii As INTEGER) IF (ISNUMERIC (Chr (Keyascii)) or keyascii = 8) Then Keyascii = 0 END SUB

2. How to control only characters in the text box, prohibit input Chinese characters? Text's IMEMode property is set to 3-Disable

Of course, the above method is just a general restriction. If you want to do full control, you have to put the shortcuts 'Ctrl V' of the text box and the right-click paste to "do it".

--- By Tang Dang Kong

转载请注明原文地址:https://www.9cbs.com/read-16664.html

New Post(0)