TextOutputStream.LastErrorCode

From Xojo Documentation

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

New in 5.5

Supported for all project types and targets.

Reports the last file I/O error. Error numbers are given as original file system error codes.

Example

This example reports the last error code if the TextOutputStream is Nil.

Dim t As TextOutputStream
Dim f As FolderItem
= GetSaveFolderItem(FileTypes1.Text, "TestFile.txt")
f f Is Nil Then Return

Try
t = TextOutputStream.Create(f)
If t <> Nil Then
t.WriteLine(TextArea1.Text)
t.Close
End If
Catch e As IOException
MsgBox("Error Code: " + Str(t.LastErrorCode))
End Try