//============================================================================== //全选DBGrid中所有数据********************************************************** //============================================================================== procedure DBGridSelectAll(DBGrid: TDBGrid); var SavePlace: TBook; begin with DBGrid do begin//01 if (dgMultiSelect in Options) and DataSource.DataSet.Active then with DataSource.Dataset do begin//02 if (BOF and EOF) then Exit; DisableControls; try SavePlace := GetBook; try First; while not EOF do begin//03 SelectedRows.CurrentRowSelected := True; Next; end;//03 finally try GotoBook(SavePlace); except end; FreeBook(SavePlace); end; finally EnableControls; end; end;//02 end;//01 end;
//全选DBGrid中所有数据**********************************************************
//==============================================================================
procedure DBGridSelectAll(DBGrid: TDBGrid);
var SavePlace: TBook;
begin
with DBGrid do
begin//01
if (dgMultiSelect in Options) and DataSource.DataSet.Active then
with DataSource.Dataset do
begin//02
if (BOF and EOF) then Exit;
DisableControls;
try
SavePlace := GetBook;
try
First;
while not EOF do
begin//03
SelectedRows.CurrentRowSelected := True;
Next;
end;//03
finally
try
GotoBook(SavePlace);
except
end;
FreeBook(SavePlace);
end;
finally
EnableControls;
end;
end;//02
end;//01
end;