Skip to content

LastErrorCode - DfBaseRichEdit

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_ATTR_INCONSISTENT_THROUGH_SELECTION The attribute in question (e.g. pbBold) was inconsistently applied in the selected text
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 value of pbBold, then checks if pbBold was not consistent throughout the selected text by checking if LastErrorCode is equal to ERR_RE_ATTR_INCONSISTENT_THROUGH_SELECTION. If so, you can do any special handling you wish in the begin...end code block.

Boolean bIsBold
get pbBold to bIsBold
if (LastErrorCode = ERR_RE_ATTR_INCONSISTENT_THROUGH_SELECTION) begin
    // do something
end

Sample

This sample gets the name of a text file from a form named oFileNameForm and calls the Read method of the oRichEdit1 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 oRichEdit1 sFileName
    get LastErrorCode of oRichEdit1 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.