I am presenting a TDBGrid to the user. I want him to select one and only one record. If he does not select a record, I want to put out an error message saying 'select a record'. The DataSource for the TDBGrid is a TQuery.
If I use the TDBGrid with the default values, if the user does not select a record and hits the 'continue' button, the query thinks the first record was selected. If I interrogate SelectedRows.Count, as long as dgMultiSelect is false, count = 0 even if the user has selected a row. As soon as I change dgMultiSelect to true (and dgRowSelect to true), SelectedRows.Count contains the number of rows selected, but I don't want to give the user the ability to select multiple rows.
Any ideas on how I can only allow the user to select one row and yet be able to detect if the user has in fact selected a row?
(We're running Delphi 4 Professional.)
If I use the TDBGrid with the default values, if the user does not select a record and hits the 'continue' button, the query thinks the first record was selected. If I interrogate SelectedRows.Count, as long as dgMultiSelect is false, count = 0 even if the user has selected a row. As soon as I change dgMultiSelect to true (and dgRowSelect to true), SelectedRows.Count contains the number of rows selected, but I don't want to give the user the ability to select multiple rows.
Any ideas on how I can only allow the user to select one row and yet be able to detect if the user has in fact selected a row?
(We're running Delphi 4 Professional.)