Read - DfBaseRichEdit
Reads RTF document and displays it in the control
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| sFileName | String | The name (and path to) of the RTF document to read |
Syntax
Procedure Read String sFileName
Call Example
Send Read sFileName
Description
Reads an RTF document and displays it in the control. Calling read will replace all text currently in the control with the contents of sFileName. If the file cannot be not opened, the LastErrorCode function will return ERR_RE_CANNOT_OPEN_FILE and the control's content will be unchanged.
Sample
This sample reads a document named MyDocument.rtf and displays its content in the oRichEdit1 control.
Procedure ReadFile
string sFileName
move "MyDocument.rtf" to sFileName
send Read of oRichEdit1 sFileName
End_Procedure // ReadFile
Sample
This sample allows the user to select a document using an OpenDialog control, and then displays the content of the document the user has selected in the oRichEdit1 control. This sample assumes that an OpenDialog control named oOpenDialog1 exists in your code.
Procedure ReadFile
string sFileName
set Filter_String of oOpenDialog1 to 'RTF Documents (*.rtf)|*.rtf|All Files (*.*)|*.*'
get Show_Dialog of oOpenDialog1 To bOk
if (bOk = True) begin
get File_Name of oOpenDialog1 to sFileName
send Read of oRichEdit1 sFileName
end
End_Procedure // ReadFile