VCL Delphi

Title: How to save and load a TTreeView
procedure TForm1.Button1Click(Sender: TObject);
var
F: TFileStream;
begin
F := TFileStream.Create('c:\TreeView.txt', fmCreate or fmShareCompat);
try
F.WriteComponent(TreeView1);
finally
F.Free;
end;
end;
// Load
procedure TForm1.Button2Click(Sender: TObject);
var
F: TFileStream;
begin
F := TFileStream.Create('c:\TreeView.txt', fmOpenRead or fmShareDenyWrite);
try
F.ReadComponent(TreeView1);
finally
F.Free;
end;
end;