[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomTreeView.LoadFromStream

Loads tree nodes from the specified stream.

## Declaration

Source position: comctrls.pp line 3730

`public procedure TCustomTreeView.LoadFromStream(`
`Stream: TStream`
`);`

## Arguments

`Stream` |  | TStream instance with the tree node data loaded in the method.

## Description

LoadFromStream is a method used to load the tree nodes from the specified TStream instance into the Items property. Stream contains the textual representation for the tree node hierarchy generated using SaveToStream.

Each tree node in Stream is represented using leading Tab (#9) characters for the level in the tree node, followed by the Text for the node and an end-of-line sequence (#13#10). TTreeNode instances are created and added to the Items property when the node values are read from the stream.

Remark: | LoadFromStream does not change the position in Stream prior to reading node values. It assumes the stream position has been set in the calling routine. It does not reset the stream position when the method has been completed.

Use SaveToStream to store the textual representation for tree nodes in Items to a given TStream instance.

Use SaveToFile and LoadFromFile to read and write the node hierarchy using file-based storage.

## See also

TCustomTreeView.Items |  | The container with the TTreeNode instances for the control.
TCustomTreeView.SaveToStream |  | Saves the tree nodes in Items to the specified stream.
TCustomTreeView.SaveToFile |  | Saves the tree nodes in Items to the specified file.
TCustomTreeView.LoadFromFile |  | Loads tree nodes from the specified file.
TTreeNode.Level |  | The number of ancestor nodes for the current tree node.
TTreeNode.Text |  | Text displayed for the tree node.
TTreeNodes |  | Implements a container for TTreeNode instances.