sorry,笔误
应为dbgrid所对的datasource.autoedit属性设为false

解决方案 »

  1.   

    Re: 4176
      DBGrid没有AutoInsert属性。
    Re:wangxd1976
      应为dbgrid所对的datasource.autoedit属性设为false 也不能实现此功能。
      

  2.   

    在 DBgrid 的 OnKeyDown 中屏蔽这些键。
     
      

  3.   

    在 DataSet 的 OnNewRecord 事件中加入以下代码:  DataSet.Cancel;
      

  4.   

    Re: Apollo47
       DBGrid的OnKeyPress中加入:
      if Key=CHR(VK_DOWN) then Key:=#0;  不能屏蔽向下箭头键的增加记录的功能。Re: Zengyufeng
      在 DataSet 的 OnNewRecord 事件中加入以下代码:
      DataSet.Cancel;   则正常情况都不能增加记录。
      

  5.   

    //在 DBGrid 的 OnKeyDown 中加入以下代码var
      DataSet: TDataSet;
    begin
      if (Sender is TDBGrid) then
      begin
        DataSet := TDBGrid(Sender).DataSource.DataSet;
        if (Key = VK_DOWN) and Assigned(DataSet) and 
          (DataSet.RecNo = DataSet.RecordCount - 1) then Key := 0;
      end;
    end;