frw
asked on
Saving entries as an ini.file
Hello,
Need some advice on how to save multiple
entries to an ini file without the first entry being deleted.A good example
would be like the (add favourites) web
page in Internet Explorer 5.
I also need advice on how to retrieve
an item from the saved list or ini file maybe through a listbox or combobox.
Need some advice on how to save multiple
entries to an ini file without the first entry being deleted.A good example
would be like the (add favourites) web
page in Internet Explorer 5.
I also need advice on how to retrieve
an item from the saved list or ini file maybe through a listbox or combobox.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do this:
var
Keys : TStringList;
UniqueKey : String;
....
Keys := TStringList.Create;
with TInifile.create('my.ini') do
begin
ReadSection('Section', Keys);
UniqueKey := MakeUniqueKey(Keys);
WriteString('Section', UniqueKey, 'Value');
Free;
end;
Keys.Free;
Of course, you will need to write the MakeUniqueKey function, but that should be fairly simple...
Cheers,
Raymond.
var
Keys : TStringList;
UniqueKey : String;
....
Keys := TStringList.Create;
with TInifile.create('my.ini') do
begin
ReadSection('Section', Keys);
UniqueKey := MakeUniqueKey(Keys);
WriteString('Section', UniqueKey, 'Value');
Free;
end;
Keys.Free;
Of course, you will need to write the MakeUniqueKey function, but that should be fairly simple...
Cheers,
Raymond.
ASKER
Thanks for your response ...if you use
the same button etc to automatically store a value to your inifile it will replace whats existing.My question would be in order not to replace an existing entry, how do you keep adding
data with lets say one 'ADD' button.
You would have to somehow keep changing
to a new key to have new data entered.