I would like my application to remember which selected row in the database table was used (selected) before the application got closed and then load it (have it selected) the next time the application starts.The table has only 4 records and is read only so I dont have to worry if someone tries to change anything. Right now I use :
procedure TForm3.ClientDataSet1AfterOpen(DataSet: TDataSet);
begin
Clientdataset1.DisableControls;
try
cxGrid1DBTableView1.DataController.KeyFieldNames := 'ID';
cxGrid1DBTableView1.DataController.LocateByKey('4');
finally
Clientdataset1.EnableControls;
end;
end;
But this is hardcoded. I want it flexible. How can I save these settings to an ini file located in the application.exe folder and load them when the application starts ? So ,for example,if key was '3' (when the app. exited) I load it the next time.