TdxCustomMemData.LoadFromTextFile(string) Method
Loads data from a plain text file.
Declaration
procedure LoadFromTextFile(const AFileName: string); dynamic;
Parameters
Name | Type | Description |
---|---|---|
AFileName | string | The source plain text file previously created by a SaveToTextFile procedure call. |
Remarks
Call the LoadFromTextFile
procedure to populate the memory-based dataset with data from a plain text file previously created by a SaveToTextFile procedure call. To define a character used as a column separator, use the DelimiterChar property.
Important
SaveToTextFile and LoadFromTextFile
procedures depend on the current locale settings. The LoadFromTextFile
procedure may not be able to load a text file created on a machine with different locale settings.
To ensure that saved data is loaded correctly regardless of locale settings, use SaveToBinaryFile, SaveToStream, LoadFromBinaryFile, and LoadFromStream procedures instead.
Example
The following code example sets a semicolon as a column separator and copies data between two memory-based datasets through a plain text file.
dxMemData1.DelimiterChar := ';'; // Sets a semicolon as a column separator
dxMemData1.SaveToTextFile(ExtractFileDir(Application.ExeName) + 'data.txt');
dxMemData2.DisableControls; // Disables data synchronization with bound controls
try
dxMemData2.DelimiterChar := ';'; // Sets a semicolon as a column separator
dxMemData2.LoadFromTextFile(ExtractFileDir(Application.ExeName) + 'data.txt');
finally
dxMemData2.EnableControls; // Re-enables data synchronization with bound controls
end;