设Edit1.Maxlength:=3;
在edit.onpress中
var str:string;
begin
str:=Edit.text;
if (length(str)=0)or(length=2) then
begin
if key not in ['1'..'9'] then
key=#0;
end
else if (length(str)=1 then
if key not in['.'] then
key=#0;
end;
在edit.onpress中
var str:string;
begin
str:=Edit.text;
if (length(str)=0)or(length=2) then
begin
if key not in ['1'..'9'] then
key=#0;
end
else if (length(str)=1 then
if key not in['.'] then
key=#0;
end;
解决方案 »
- 求一个正则表达式
- C# excel导入sql server
- ****数据绑定参数问题???
- 有个小错误,请大家帮忙解决!
- DATAGRID,DropDownList,能用控件直接实现绑定吗?
- 下拉列表如何实现以前ASP中 onchange="javascript:location.href=url.asp?action="+this.value
- 如何根据页面的长度动态的设置DataGrid每页显示的行数?
- 如何实现用机器码保护ASP.NET程序不被盗版?
- DetailsView 控件如何做更新、插入操作
- 网络公司招聘Web程序开发人员!
- ★★★求如何在本页得到上个页面的地址的方法!★★★
- listbox的face
begin
if Length(Edit1.Text)>3 then
begin
ShowMessage('请重新输入');
(Sender as TEdit).SetFocus;
exit;
end;
try
strtofloat(Edit1.Text);
if pos('.',Edit1.Text)<> 2 then
begin
ShowMessage('请重新输入');
(Sender as TEdit).SetFocus;
end;
except
ShowMessage('请重新输入');
(Sender as TEdit).SetFocus;
end;
end;
if not (key in['0'..'9','.',#8,#13,#46]) then
begin
key:=#0;
end;其中#13是回车键,#46是退格键,