Skip to content

Write - DFBaseTextEdit

Writes text file content of control to file

Type: Procedure

Parameters

Parameter Type Description
sFileName String The name (and path to) of the text file to write

Syntax

Procedure Write String sFileName

Call Example

Send Write sFileName

Description

Writes the entire content of control to file specified by sFileName.

Sample

This sample writes the entire content of control oTextEdit1 to a document named MyFile.txt.

Procedure ReadFile
    string sFileName

    move "MyFile.txt" to sFileName

    send Write of oTextEdit1 sFileName
End_Procedure  // ReadFile

Sample

This sample allows the user to select a document using an SaveAsDialog control, and then writes the entire content of control oTextEdit1 to the document name the user has specified in the SaveAsDialog. This sample assumes that a SaveAsDialog control named oSaveAsDialog1 exists in your code.

Procedure ReadFile
    string sFileName

    set Filter_String of oSaveAsDialog1 to 'Text Files (*.txt)|*.txt|All Files (*.*)|*.*'
    get Show_Dialog of oSaveAsDialog1 To bOk
    if (bOk = True) begin
        get File_Name of oSaveAsDialog1 to sFileName
        send Write of oTextEdit1 sFileName
    end
End_Procedure  // ReadFile