notacreativeguy
Programmer
Hey all, I'm working with Delphi and trying to edit text that's already in a notepad file. I'm not sure why it's not working. Here's my following code, can you tell me what I'm doing wrong?
var testlist: TStringList;
var i: integer;
begin
testlist := TStringList.Create;
if FileExists('P:\myUpgrade.scr') then
begin
testlist.LoadFromFile('P:\myUpgrade.scr');
i := testlist.IndexOf('AAAA');
if i>0 then
testlist := lblNewPrfx1.Caption;
testlist.SaveToFile('P:\myUpgrade.scr');
end;
testlist.Free;
end;
end.
I'm trying to replace 'AAAA' with the contents of the NewPrfx label. Please help.
var testlist: TStringList;
var i: integer;
begin
testlist := TStringList.Create;
if FileExists('P:\myUpgrade.scr') then
begin
testlist.LoadFromFile('P:\myUpgrade.scr');
i := testlist.IndexOf('AAAA');
if i>0 then
testlist := lblNewPrfx1.Caption;
testlist.SaveToFile('P:\myUpgrade.scr');
end;
testlist.Free;
end;
end.
I'm trying to replace 'AAAA' with the contents of the NewPrfx label. Please help.