Board index » delphi » Problem with Data Grid Selected Rows

Problem with Data Grid Selected Rows

I am having a problem using the Data Grid's Selected Rows property in
Delphi 3. I am able to select a number of records on the list but I do
not know how to select the first selected records and loop through each
of them. I think it is something to do with the 'SelectedRows.Items[]'
property, but I am not sure.
Can anyone help.

--
Patrick Cashman
Senior Software Engineer

NiSoft (UK) Limited

 

Re:Problem with Data Grid Selected Rows


Hi Patrick

The key to this is setting the bookmark property of the table to the
current value of the SelectedRows.Items collection.

Here is some sample code:

         if dbgArea.SelectedRows.Count > 0 then
         begin
            tblReportArea.DisableControls;
            for intCount:= 0 to dbgArea.SelectedRows.Count-1 do
            begin
                //move to the row in the table
                tblReportArea.Bookmark:=
dbgArea.SelectedRows.Items[intCount];
                //do processing on table record here
            end
            tblReportArea.EnableControls;
         end

Dean Ashton
CW Pope and Associates

Quote
Patrick Cashman wrote:
> I am having a problem using the Data Grid's Selected Rows property in
> Delphi 3. I am able to select a number of records on the list but I do
> not know how to select the first selected records and loop through each
> of them. I think it is something to do with the 'SelectedRows.Items[]'
> property, but I am not sure.
> Can anyone help.

> --
> Patrick Cashman
> Senior Software Engineer

> NiSoft (UK) Limited

Other Threads