Board index » delphi » Using TDBGrid.SelectedRows

Using TDBGrid.SelectedRows

Can anyone provide me with a simple example of how to use
TDBGrid.SelectedRows?  I want the user to be able to tag several records,
press the OK button, then add all of the selected records to another table.

Any help is appreciated.

Thanks,
Jesse

 

Re:Using TDBGrid.SelectedRows


Hi Jesse,

Try something like this:

procedure TForm1.Button1Click(Sender: TObject);
var
   i: integer;
begin
   Query1.First;
   Query1.DisableControls;
   repeat
       if DBGrid1.SelectedRows.CurrentRowSelected then
       begin
         So whatever...
       end;
       query1.Next;
   until Query1.Eof;
   Query1.EnableControls;

Hope that helps.

********************************
Michael Glatz
glatzfa...@aol.com
mgl...@briefcase.com

Other Threads