Gambas Documentation - /comp/gb/file/load

# File.Load (gb)

Static Function Load ( FileName As String ) As String

Loads a file and returns its contents as a string.

This example shows how Load can be used as a easy way to open a text file and display it in a TextArea.

### Examples

    PUBLIC SUB ButtonOpen_Click()
      Dialog.Filter = ["*.txt", "Text Files"]
      IF Dialog.OpenFile() THEN RETURN
      TextAreaEdit.Text = File.Load(Dialog.Path)
    CATCH
      Message.Info(Error.Text)
    END

The changed text could be saved using File.Save method.