在OnChange事件中写代码控制,可以实现.不过太麻烦.
你可以逐一判断输入字符是否在['0'..'9','.','+','-'],
并且+ - 只能有一个,位于第一个;
.只能有一个,不能位于第一个....等等.
笨办法.
你可以逐一判断输入字符是否在['0'..'9','.','+','-'],
并且+ - 只能有一个,位于第一个;
.只能有一个,不能位于第一个....等等.
笨办法.
解决方案 »
- 不显示删除回复显示所有回复显示星级回复显示得分回复 跪求高手啊,我每次按了ctrl+f2也就是program reset的时候,都会弹出下面的对话框,然后就必
- 提示Array Type Required!简单问题, 二维数组如何做函数参数?
- 简单的treeview问题,delphi新手不知道如何解决
- 怎样关闭一IE浏览器窗口?
- 高手求救,如何通过ShellApi发送带附件的邮件(在线求救)
- 这个sql语句可以再优化吗?欢迎大侠指点
- 这个delphi作的dll怎么就不能被别的编译器编译的程序调用呢?
- 一个小问题,请看看
- 为什么我使用元件wordcap时候,出现file not found'DsgnIntf.dcu'??
- 如何将实现“填表快手”软件中的将文本的内容拖入到IE中的网页的编辑框中
- 经过代理服务器如何进行文件传输
- dbgrid中的小问题,快来抢分!
selCol, yourCol: TColumn;procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if (selCol = yourCol) and not (Key in ['.','0', '1','2','3','4','5','6','7','8','9']) then Key := #0;
end;procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
selCol := Column;
end;
begin
if Not (Key in ['0'..'9','.']) then Key:=#0;
end;
begin
if not ((key in ['0'..'9']) or (key = #8) or (key = '.')or(key =#13)) then
begin
key := #0;
end;
end;
begin
if not ((key in ['0'..'9']) or (key = #8) or (key = '.')or(key =#13)) then
begin
key := #0;
end;
end;
begin
if (DBGrid1.SelectedField.Index=3) and (Not (Key in ['0'..'9','.',#8])) then
Key:=#0;
end;
begin
if (Key='.') and (Pos('.',DBGrid1.SelectedField.AsString)<>0) then Key:=#0;
if (DBGrid1.SelectedField.Index=3) and (Not (Key in ['0'..'9','.',#8])) then
Key:=#0;
end;
try
strtofloat(edit1.text);
except
Application.MessageBox('数字输入错误','提示',mb_ok+mb_iconstop);
edit1.SetFocus;
exit;
end;