为什么不执行i:=i+1;解决思路
为什么不执行i:=i+1;
if Key=#13 then
begin
i:=0;
while i<SGrd.RowCount-2 do
begin
SGrd.Cells[2,i+1]:=Trim(Edit3.Text);
Edit3.Text:='';
Break;
end;
end;
i:=i+1;
Edit3.SetFocus;
------解决方案--------------------
代码格式化后,就更容易看清楚了:
if Key=#13 then
begin
i:=0;
while i<SGrd.RowCount-2 do
begin
SGrd.Cells[2,i+1]:=Trim(Edit3.Text);
Edit3.Text:='';
Break;
end;
end;
i:=i+1;
Edit3.SetFocus;
------解决方案--------------------
代码格式化后,就更容易看清楚了:
- Delphi(Pascal) code
if Key = #13 then begin i := 0; while i < SGrd.RowCount - 2 do begin SGrd.Cells[2, i + 1] := Trim(Edit3.Text); Edit3.Text := ''; Break; end; end; i := i + 1; Edit3.SetFocus;