TextInputStream.LastErrorCode

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 = aTextInputStream.LastErrorCode

New in 5.5

Supported for all project types and targets.

Reports the last file I/O error.

Notes

Error numbers are given as original file system error codes.

Example

This example reports the last error code if the method could not open the file.

Dim f As FolderItem = SpecialFolder.Documents.Child("test.txt")
Dim t As TextInputStream

If f <> Nil And f.Exists Then
t = TextInputStream.Open(f)
// make sure we could open it
If t <> Nil Then
// Read all of t into myEditField.text
myTextArea.Text = t.ReadAll
// close the file so that other applications can use it
t.Close
Else
// the file could not be a read as a text file
MsgBox("The selected file is not a text file. Error: " + Str(t.LastErrorCode))
End If
End If