Würd das auch nicht so schreiben:
Delphi-Quellcode:
If openDialog1.Filename = '
'
then showmessage('
no file loaded dumbass')
else
begin
try
filedata.Create;
try
filedata.LoadFromFile(opendialog1.FileName);
except
on E:
Exception do
begin
showmessage(e.
Message);
end;
end;
databegin:=filedata.IndexOf(edit1.Text);
dataend:=filedata.IndexOf(edit2.Text);
finally
FreeAndNil(filedata);
FreeAndNil(datacontent);
end;
end;
Sonder so:
Delphi-Quellcode:
If openDialog1.Filename = '
'
then
begin
showmessage('
no file loaded dumbass');
end else
begin
try
filedata := TStringList.Create;
try
filedata.LoadFromFile(opendialog1.FileName);
except
on e :
exception do
showmessage(e.
Message);
end;
databegin := filedata.IndexOf(edit1.Text);
dataend := filedata.IndexOf(edit2.Text);
finally
filedate.free;
end;
end;
So ist doch übersichtlicher, oder nicht?
Ausserdem, wofür brauchst du das "datacontent"??