如题
解决方案 »
- EDIT的控制?
- 请问,如何在在数据库中插入图片阿?
- 请问十六进制的转换问题!
- XML问题,请各位帮忙,高分!在线等待。。。。
- 如何判断字符串1中是否包含字符串2的内容?
- 请教:解释一下THandle,句柄是什么,干什么用~
- 我搜索了一下,这个问题从来没有人的回答让人满意。
- 关于:解析xml文档,用按钮点击时正常,但放入线程后,报Microsoft MSXML is not installed错误!这是什么原因?
- 我用indy组件中的Tidhttp控件来下载网页链接,如何能够得到链接的文件名称啊?
- 请问用ado建库、建表应该加上哪些控件?语句如何写?
- 如何取消MDI主窗口背景图片,让MDI主窗口显示指定颜色呢
- 怎样设置打印字体的大小?在线等待?马上给分
begin
if (Key<'0') or (Key>'9') then Key:=Char(0);
end;
如果你是想输入IP地址的话
可以下载专门的控件!
他好像是Windows的标准窗口类
var Key: Char);
begin
if (not (Key in ['0'..'9'])) and (Key <> '.') and (Key <> chr(8)) then
Key := chr(0);
end;我觉得你还有必要加上回退键,这样就可以让用户修改了。
我用过,老是报错:类型不匹配,怎么办?
StrToFloat(jvfloatedit1.text);
except
postmessage(jvfloatedit1.handle,wm_keydown,vk_back,0);
end;
在keypress里需要转换一下 Word(Key) = VK_BACKSPACE
begin
if Assigned(CurField) then
begin
if (CurField.DataType in [ftFloat, ftCurrency, ftBCD]) then
begin
if not ((key in ['0'..'9', '.', '-', #8])) then
begin
key := #0
end
else
begin
if (Key = '.') and (Pos('.', TEdit(Sender).Text) <> 0) then
Key := #0
else if
(Key = '-') and (Pos('-', TEdit(Sender).Text) <> 0) then
Key := #0;
end;
end
else if (CurField.DataType in [ftAutoInc, ftSmallint, ftInteger, ftWord,
ftBytes, ftLargeint]) then
begin
if not ((Key in ['0'..'9', '-', #8])) then
begin
Key := #0
end
else
begin
if (Key = '-') and (Pos('-', TEdit(Sender).Text) <> 0) then
Key := #0;
end;
end
else
Exit;
end;
end;
begin
if (key='.') and (pos('.',Tedit(sender).Text)=0) then exit;
key:=#0;
showmessage('必须填入数字!');
end;
编写代码,在keydown 事件中编写代码 ……进行判断