首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

为什么不执行i:=i+1;解决思路

2012-03-27 
为什么不执行i:i+1if Key#13 thenbegini:0while iSGrd.RowCount-2 dobeginSGrd.Cells[2,i+1]:Trim(

为什么不执行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;

[解决办法]
代码格式化后,就更容易看清楚了:

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; 

热点排行