Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
Turbo Delphi für Win32
|
Re: Mehrere Memo's Speicher
25. Jan 2007, 13:25
Lass die ganzen TStream.Position-Zuweisungen weg. Setze nur am Anfang die Position auf 0, alles weitere erledigt TStream.Read automatisch.
Delphi-Quellcode:
procedure TForm7.Button9Click(Sender: TObject);
var
memos :TFileName;
FileStream: TMemoryStream;
l,i: Integer;
begin
FileStream := TMemoryStream.Create;
memos:= ExtractFilePath(ParamStr(0))+'Bemerkungen\'+ ComboBox4.Text+'.txt'
FileStream.LoadFromFile(memos);
l := 0;
for i := 1 to 5 do
begin
FileStream.Position := 0;
FileStream.Read(l, SizeOf(Integer));
case i of
1: FileStream.Read(Memo1.Text ,l);
{...}
5: FileStream.Read(Memo5.Text ,l);
end;
end;
FileStream.Free;
end;
end;
Manuel Eberl „The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
|