edit没有属性可以设置只能输入数字吗?vc都有的阿。
解决方案 »
- cxgrid 小数显示为百分比模式 pivotgrid 分类小记不同颜色显示
- 大家新年好,小弟初学,急问一个窗体问题,求各位大人解答!拜谢!!!
- 刚过3级数据库,为前途迷茫中,接分请顺便安慰本人几句!
- 咋整的,www.cndev.net这个网站咋上不去了。
- 如果让程序执行时可以获得参数
- 用BDE连SQL SERVER,在储存图片字段时如果图片比较大会出错,显示Invalid BLOB length,请问怎样解决?
- 子窗体最大化为什么没有滚动条?
- 求一个算法 关于从数据库中创建树
- 将vf的数据导入sql server2000时,提示日期类型不对,有数据溢出,怎么办?
- 高分急问怎么获得汉字的ASC码 Ord('问') 不行。
- zip问题(选择用VCLZIP,ZIPTV都不满意
- 函数调用??
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not(key in ['0'..'9',#8]) then key:=#0;
end;
就是ourlin说的方法!
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not(key in ['0'..'9',#8]) then key:=#0;
end;
这时正解
procedure TFrmSchSet.Edit_LmtKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9',char(VK_BACK),char(VK_DELETE)] ) then Key:=#0;
end;是相应keypress事件的函数,可以输入0到9,也可以退格和删除。
begin
if not(key in ['0'..'9',#8]) then key:=#0;
end;
begin
if not (Key in ['0'..'9',char(VK_BACK),char(VK_DELETE)] ) then Key:=#0;
end;就用这个方法比较好了.
begin
if not(key in ['0'..'9',#8]) then key:=#0;
end;
http://blog.csdn.net/comerliang/archive/2006/01/13/577879.aspx