From Xojo Documentation

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

TextInputStream.Open(f As FolderItem) As TextInputStream

New in 2009r4

Supported for all project types and targets.

Opens the passed FolderItem to be read as a text file. Returns a TextInputStream. An IO error will trigger an IOException.


Reading from the file will begin at the start of the file. If you wish to read from any other point in the file, use the BytePosition property to move the read position.

This shared method replaces the deprecated FolderItem.OpenAsTextFile.


Var f As FolderItem
Var t As TextInputStream
f = FolderItem.ShowOpenFileDialog("text") // file type defined in File Type Sets Editor
If f <> Nil Then
t = TextInputStream.Open(f)
t.Encoding = Encodings.UTF8 //specify encoding of input stream
TextArea1.Text = t.ReadAll
End if