Save/Load DBGrid user configuration

Posted in Databases

Use the LoadFromFile and SaveToFile methods for TDBGridColumns type.

procedure TForm1.Button1Click(Sender: TObject);
begin
  DBGrid1.Columns.SaveToFile('DBGrid.txt');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  DBGrid1.Columns.LoadFromFile('DBGrid.txt');
end;