procedure TfmModifyBedfee.SetDate;
begin
  try
    fmorasession.OraSession.StartTransaction;
    with qryInitdate do
    begin
      Close;
      ParamByName('inhosregisterno').AsString := finhosregisterno;
      ParamByName('BedNo').AsString := Trim(cbbBedNo.Text);
      ExecSQL;;
    end;
    Temp_BaseInfo.Close;
    Temp_BaseInfo.Open;
    Temp_BaseInfo.Last;
    Temp_BaseInfo.Append;
    fmorasession.OraSession.Commit;
    DBGridEh1.Col := 0;
    DBGridEh1.SetFocus;
  except
      fmorasession.OraSession.Rollback;
      Common1.ShowError('显示数据失败!');
  end;
  CurrAction := caBrowse;
end;每到DBGridEh1.SetFocus;就报错。为什么呢?

解决方案 »

  1.   

    这应该和你的窗体布局有关系,你换用其他方法去聚焦DBGridEh1把,比如试试DBGridEh1.focused:=true
      

  2.   

    我试试,顺便补充一个问题,如何设置属性,使得DBGRrideh可以输入数据
      

  3.   

    我发现 单独的得到焦点并不报错,
    加上DBGridEh1.Col := 0;就报错了。
      

  4.   

    DBGridEh1.Col := 0,不行,他的有效列从1开始,设置为1
    DBGridEh1本身就可以输入数据啊
      

  5.   


    谢谢你了,还有 DBGridEh1.Options := DBGridEh1.Options + [dgEditing];
    后能够将鼠标定位到DBGridEh的格里了,但是按键盘的时候没有反应。