如何限制EDIT的输入(15分)

L

lhony

Unregistered / Unconfirmed
GUEST, unregistred user!
我如何才能限制EDIT只能输入1到12的数字,希望得到回答
 
使用MaskEdit
 
在KeyPress事件中
if Key in [..........
搜索一下,DFW有许多这样的问题.
 
这是限制只能输入数字的,代码
if not (Key in [Chr(8),'0','1','2','3','4','5','6','7','8','9']) then
Key:=#0;
 
在它的onKeyPress事件中加下面代码
if not (key in ['0'..'9',#8,#13,#46])
then key:=#0 ;
 

Similar threads

回复
0
查看
739
不得闲
D
回复
0
查看
775
DelphiTeacher的专栏
D
顶部