Delphi - Using DBGrid to select rows from a search

女生的网名这么多〃 提交于 2019-12-12 06:44:27

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/3744841/delphi-using-dbgrid-to-select-rows-from-a-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!