Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question:- loading settings from ini file

Status
Not open for further replies.

Jasonic

Technical User
Jun 20, 2001
69
GB
Does anyone have instructions on how to read from an ini file when an application starts up.

I would like the application to always load up with the saved settings, but if the ini file is missing then use the default values to recreate the ini file.

any help or resources where this has been achieved would be great

thanks in advance
Jason Jason Thomas
AssetCenter Consultant
:)
 
hi

Here's a small example. Use WriteString to set values in the ini file.

uses Inifiles;

:
var LoginIni : TIniFile;
:

LoginIni := TIniFile.Create(IniPath+'\Mgr.ini');
DBName := LoginIni.ReadString('DB', 'DEFAULTDB', 'ERROR');
if (DBName = 'ERROR') then
begin
Showmessage('unable to read ini file');
end;
:
LoginIni.Free;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top