Home > Back-end >  Delphi7 code used in the selected TDBGid controls a row in the data
Delphi7 code used in the selected TDBGid controls a row in the data

Time:10-04

Delphi7 how to use the code in the selected TDBGid controls a row in the data, make the selected data highlighted??????

CodePudding user response:

In the DBGrid Options properties, dgRowSelect and dgAlwaysShowSelection to True,
And then change the number of rows in the DataSet directly, or through the Locate locating a line, the line is highlighted
DBGrid1. The DataSource. The DataSet. RecNo:=10;

CodePudding user response:

Must first have A relevant field conditions, such as "A" field, you can set the location into A="last" that line:
 
With DBGrid1. DateSurice. DateSet do
The begin
First;
While Not Eof do
The begin
If FieldByName (' A '). AsString='last' then exit.
Next;
end;
end;

CodePudding user response:

If you want to get the currently selected rows, can be obtained through SelectedIndex property

CodePudding user response:

How to conform to the conditions of how lines to choose?

CodePudding user response:

Open the multiple-choice Options. DgMultiSelect:=True;
In his chosen SelectedRows, select the bookmark; Direct manipulation,
  • Related