如何验证仅编辑数字&在Inno Setup中只有文字? [英] how to validate Edit to only numbers & only text in inno setup?
本文介绍了如何验证仅编辑数字&在Inno Setup中只有文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以将字符限制为数字,并且长度不能超过10个字符而没有空格,而只需进行另一次编辑? 它是一个电话号码,名字不需要空格,不知道该怎么做.找到了尝试执行某些方法但不起作用的代码 这是我发现的不允许信件的内容.
Is there a way to limit the characters to numbers and lenght to 10 with no space and another edit for just ? its for a phone number, and name that needs to have no spaces, dont have an idea how to do it. Found a code that try some ways to implement but dont work here is what I found for dont allow letters.
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key in ['a'..'z']) or (Key in ['A'..'Z']) then
Key := #0;
end;
此处不允许输入数字:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key in ['0'..'9'] then
Key := #0;
end;
并且没有空格:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key = Char(VK_SPACE) then
Key := #0;
end;
可以在inno中实现类似的功能吗?
can implement something similar in inno?
推荐答案
您可以编辑Edit1的MaxLength属性以限制字符
You can edit MaxLength property of Edit1 to limit character
Edit1.MaxLength:=10;
这篇关于如何验证仅编辑数字&在Inno Setup中只有文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文