Re: Data Between DbGrids

Posted by DB Man on April 01, 2005

In Reply to: Data Between DbGrids posted by Stoffle on April 01, 2005

... using 2 dbgrids on one form and transfering the data, back and forth between the 2, ive done that, but now i need help on multi select, i only want to move the data that i have selected must be more than one! So I need how to do Multi Select in a while eof statement.

Example code, based on Delphi Help info:

procedure TFormMain.Button1Click(Sender: TObject);
var
  i: integer;
begin
  if DBGrid1.SelectedRows.Count > 0 then begin
    for i := 0 to DBGrid1.SelectedRows.Count - 1 do begin
      with DBGrid1.DataSource.DataSet do begin
        GotoBookmark(Pointer(DBGrid1.SelectedRows.Items[i]));
        // do something, e.g. copy record to other table:
        // ...
      end;
    end;
  end;
end;