Re: Removing from INI file



On Mon, 19 Sep 2005 00:25:40 GMT, "Brian" <not@xxxxxxxxx> wrote:

>Hi
>
>How do you remove and entry from a INI when you only know the
>value and not the key?
>I'm trying to say remove the line KEY=VALUE where VALUE = X

This is a bit dangerous as you might have more than one entry
containing the Value, but I suppose you are only going to use it on
your own Files

The simplest method is probably to get the data into a TStringList

Here is a heavy hint :-

Uses IniFiles;

procedure TForm1.Button1Click(Sender: TObject);
Var
MI :TMemIniFile;
begin
MI := TMemIniFile.Create( 'c:\windows\win.ini' );
MI.GetStrings( ListBox1.Items );
MI.Free;
ShowMessage( ListBox1.Items.Text );
end;


.


Quantcast