在DBGRID中,如何将用户TAB键用ENTER代替(200分)

多人接受答案了。
 
在DBGRID控件的ONKEYPRESS事件中编写如下代码:
if (key=char(vk_return)) and
(dbgrid1.selectedindex<table1.fieldcount-1 ) then
dbgrid1.selectedindex:=dbgrid1.selectedindex+1
else
if dbgrid1.selectedindex=table1.fieldcount-1 then
begin
table1.append;
dbgrid1.selectedindex:=0;
end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
顶部