Node Object Method: SaveData, LoadData 

Purpose

Saves or loads all data belonging to the node (and its descendants) to or from a file.

Syntax

The SaveData method has the syntax:

SaveData(String DocName, String StreamName)

The LoadData method has the syntax:

LoadData(String DocName, String StreamName)

Return Value

type Boolean

Description

These two methods save or load all data of the node (and of its descendants) to or from a file.

The parameters specify the compound document in DocName and a stream in StreamName. If the document does not exist, a document is created. If the stream does not exist, a stream is created, otherwise the existing stream is overwritten.

For these methods, the compound document is a file, and the stream contains data for a single tree (single node and its descendants). For multiple trees, different stream names are used to store different sets of nodes (or other data) in the compound document. For more information on compound documents, see the OLE2 references.

When loading a node’s data with LoadData, the stream need not necessarily be created by a node with the same structure as the node to which the data is being loaded.

During loading, the same mechanism that is used with Drag and Drop with Tree Views works. Any property item in the node being loaded is compared with the item from the loading stream. If the Name and the Type for the target item are the same as those from the loading stream, the target item is assigned the data from the stream. Otherwise the target item remains untouched.