Limit the input of the text box (only enter the number)

xiaoxiao2021-03-06  102

Text box prevents illegal characters from entering:

Enter an integer: private sub text1_keypress (Keyascii As Integer) Select Case Keyascii Case ASC ("0") To ASC ("9"), VBKEYBACK 'NOPCase Else Keyascii = 0nd SelectensEnd Sub

Only enter the decimal:

Private sub text1_keypress (Keyascii As INTEGER) SELECT CASE Keyascialase ASC ("0") To ASC ("9"), VBKEYBACK 'NOP

Case ASC (".") 'Allows a decimal point if INSTR (1, Text1.Text, ".")> 0 THEN Keyascii = 0

Case else keyascii = 0

End SelectenD Sub

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

New Post(0)