Delphi - Using DBGrid to select rows from a search
Asked Answered
D

1

-1

I have searched a database using a query.

The results of the search are displayed in a DBGrid component for the user to select the row s/he wishes to proceed with.

DBGrid always sets the record pointer to the first record in the results set, so a row is always "selected" by default. I need to change this behaviour to no row being selected when the data is first presented so that I can determine if the user has actually made a selection.

Is it possible to tell if no selection has been made, i.e. no row has been selected by the user?

Any help very much welcomed!

Discretion answered 19/9, 2010 at 7:9 Comment(0)
P
2

You can include dgMultiSelect into DBGrid.Options, then DBGrid.SelectedRows will contain list of explicitly selected record bookmarks. Without dgMultiSelect the DBGrid always track the current dataset record.

Preceptive answered 19/9, 2010 at 8:1 Comment(2)
Thanks for the reply - I solved it myself through further experimentation.Discretion
Downvoted because it's bad etiquette to abandon a post just because you found the answer elsewhere. If it was important enough to post a question, it should be important enough to share the answer. Someone else may be looking for a similar solution. Post your answer and I'll remove my downvote.Jounce

© 2022 - 2024 — McMap. All rights reserved.