为什么我的数据在DBGRID里显示后,不可以选定行,只可以选定一个字段?
我想在显示数据后,选定一行后,然后删除,可是不好选,不知道是什么原因,请大家帮帮忙!

解决方案 »

  1.   

    设置属性:
    options-->dgMultiselect-->true
      

  2.   

    删除功能的按钮代码:procedure TForm1.Button1Click(Sender: TObject);
    var
    i: Integer;
    beginif not DBGrid1.DataSource.DataSet.IsEmpty  then{--如果DBGrid1所连接的数据记录不为空--}
      if DBGrid1.SelectedRows.Count>0 then {---如果选择的行数不为零---}
         with DBGrid1.DataSource.DataSet do
              for i:=0 to DBGrid1.SelectedRows.Count-1 do
              begin
                    GotoBook(pointer(DBGrid1.SelectedRows.Items[i]));
                    Delete;
              end;
    end;