procedure Tmainform.DBGrid1KeyPress(Sender: TObject; var Key: Char); begin if key:=#13 then begin table1.Insert; table1['It']:=table2.fieldbyname('It').asstring; end; end;我这样设错了吗
if key:=#13 then //应改为if key = #13 then
应该是if key=chr(13) then 在keydown中是 key=#13
你这样做,if key=#13 then begin 这样才对吧,相当于回车啊!
to wrsy: 这个试了也不行啊
to chao_jian() 和 hezchuan168(开心果) 这两个方法也不起作用,问题如我所提的
你的问题不是健值,而在其他地方, if key:=#13 then begin application.messagebox(-----); end; 如果没有问题,就在你的table1出的问题
还是哪个提示,我想再问一下,这个东西可以重用的吧,在别的FORM里面用应该不会出问题的是吗
判断非字符按键,必须在OnKeyDown事件中。
谁说:判断非字符按键,必须在OnKeyDown事件中。 在OnKeyDown事件中,要使用Virtual key codes 在OnKeyPress事件中,是a single character key press事件=========================== 还有楼主,让我拿什么拯救你呀!以后要好好看帮助。 把你的错误提示发上来,Okey
key := #13;
begin
if key:=#13 then
begin
table1.Insert;
table1['It']:=table2.fieldbyname('It').asstring;
end;
end;我这样设错了吗
if key:=#13 then //应改为if key = #13 then
在keydown中是 key=#13
begin
这样才对吧,相当于回车啊!
这个试了也不行啊
if key:=#13 then
begin
application.messagebox(-----);
end;
如果没有问题,就在你的table1出的问题
在OnKeyDown事件中,要使用Virtual key codes
在OnKeyPress事件中,是a single character key press事件===========================
还有楼主,让我拿什么拯救你呀!以后要好好看帮助。
把你的错误提示发上来,Okey