Skip to content

LastErrorCode - DFBaseTextEdit

Returns error code for last operation

Type: Function
Return Data Type: Integer

Syntax

Function LastErrorCode Returns Integer

Call Example

Get LastErrorCode to IntegerVariable

Description

Returns the error code for the last operation.

Possible return values are:

Constant Meaning
ERR_RE_SUCCESS Success, operation successful, no error condition
ERR_RE_FNAME_TOO_LONG File name is too long
ERR_RE_CANNOT_OPEN_FILE Cannot open file

Sample

This sample gets the name of a text file from a form named oFileNameForm and calls the Read method of the oTextEdit1 control to open that file. It then checks to see if the control was able to open the file by checking the LastErrorCode. If LastErrorCode returns ERR_RE_CANNOT_OPEN_FILE, it displays an error message to the user.

Procedure ReadFile
    string sFileName
    integer iLastErrorCode

    get Value of oFileNameForm to sFileName

    send Read of oTextEdit1 sFileName
    get LastErrorCode of oTextEdit1 to iLastErrorCode
    if (iLastErrorCode = ERR_RE_CANNOT_OPEN_FILE) begin
        send Stop_Box "Cannot open file" "ERROR"
    end
End_Procedure  // ReadFile

Return Value

Error code for the last operation.