如何判断eidt文本框中输入的是不是float类型的数据
解决方案 »
- Delphi 控制 CodeSoft 报错 Method 'Dialogs' not supported by automation object
- DBGrid里CheckBox状态更改时候如何让数据库内数据同步更改!!!!!!!!!!
- 如何在dll中保存数据?
- 创建窗体的问题
- 使用HOOK编个老板键过程中碰到的问题。
- delphi程序在运行时出现Record/key deleted错误,是什么原因导致的呢》该如何解决?
- ADOQuery真的让人迷惑????
- 求ADOTable的排序方法。。在线等,,
- 见者有分,那位兄台告诉我一些关于dll得资料和关于组件开发的例子!
- 为什么Application.CreateForm(Tmilk_main, milk_main)不能建立一个milk_mainp窗体?
- 如何编写一个项目进度文档?请大家各抒己见!
- delphi 7的问题
strtofloat(edit.text);
except
showmessage('不是有效的浮点型直');
end;
var
s:string;
i,j:integer;
begin
s:=form1.Edit1.Text;
if pos('.',form1.Edit1.Text)>0 then
begin
i:=length(s);
for j:=0 to i-1 do
begin
if s[j]='.' then
begin
if j>1 then
showmessage('true');
end;
end;
end;
end;
//确保edit1中只能输入数字、'.'、和退格键
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9',#8,'.']) then
begin
key:=#0;
messagebeep(1);
end;
end;
strtofloat(edit.text);
except
showmessage('不是有效的浮点型直');
end;
照抄就可以了
有问题请发信息到我的E-mail:[email protected]