Select input in Edit

xiaoxiao2021-03-05  23

IF not (key in ['0' .. '9', # 8]) THEN BEGIN Key: = # 0; MessageBeep (1); showMessage ('password can only be numbers ") End; ****** ************************************ E: = (sender as tedit); / / need limited input The control can share this code if not (Key IN [# 48 .. # 57, '.', '-', # 8]) // acceptable character or (key = '-') AND (e. SELSTART> 0) // The negative is only in the serial port or (key = '.') And (POS ('.', E.text)> 0) THEN key: = # 0; // only accept a decimal point * ******************************************************* Procedure TFORM1.EDIT1KEYPRESS (Sender: Tobject; Var Key) CHAR); Begin if Not (Key In ['0'. '9', CHR (vk_back), chr (vk_delete)]) The begin key: = # 0; MessageBeep (0); end; end;

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

New Post(0)