From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Integer )
IntegerValue = aFolderItem.LastErrorCode

Supported for all project types and targets.

Contains the error code for the last supported operation on the FolderItem. LastErrorCode will be set for any error.


To determine which error code was returned in the LastErrorCode property, you can test it against one of the FolderItem error constants. They are given in the following table:

Error Code Constant Description
0 NoError

New in 2005r1

No error occurred.
100 DestDoesNotExistError Destination does not exist. You will get this error only on CopyFileTo and MoveFileTo.
101 FileNotFound The File was not found.
102 AccessDenied Access was denied.
103 NotEnoughMemory You ran out of memory.
104 FileInUse The file is in use.
105 InvalidName You used an Invalid name.

LastErrorCode may also return operating system-specific error codes if the error does not map to one of the above errors. These codes may have values less than 0. For more information about OS-specific codes, check here:

  • Windows: Error Codes at MSDN
  • MacOS: Use the macerror command in Terminal to find a description of an error. For example:
    macerror -49
    which displays:
    Mac OS error -49 (opWrErr): file already open with write permission
    In addition you can check the older Mac OS System Error Codes, which are can still be useful since LastErrorCode uses older Carbon error codes.
  • Linux: C Error Codes in Linux

Sample Code

This code displays the error code if an error occurred.

Dim f As New FolderItem
f = GetOpenFolderItem("text/plain")
If f.LastErrorCode <> 0 Then
End If