TextOutputStream.Create

From Real Software Documentation

Jump to: navigation, search
Method
TextOutputStream.Create ( f As FolderItem ) As TextOutputStream

Creates a text file for so that text can be written. The write is done by calling Write or WriteLine. Call Close when you are finished writing to the file.

Notes

An IO error will trigger an IOException.

The Create shared method replaces the deprecated FolderItem.CreateTextFile.

Example

This example writes text into a field on a form.

Dim f as FolderItem = GetSaveFolderItem(FileTypes1.Text,"Create Example.txt")
If f <> Nil then
Try
Dim t as TextOutputStream = TextOutputStream.Create(f)
Try
t.WriteLine(TextField1.text)
Finally
t.Close
t = nil
End Try
Catch e as IOException
//handle error
End Try
End if
Personal tools