Share via


TextBuffer.fromFile Method

Definition

Overloads

fromFile(String)

Replaces the content of a TextBuffer object with the content of the specified file.

fromFile(String, Int32)

fromFile(String)

Replaces the content of a TextBuffer object with the content of the specified file.

public:
 virtual bool fromFile(System::String ^ text1);
public virtual bool fromFile (string text1);
abstract member fromFile : string -> bool
override this.fromFile : string -> bool
Public Overridable Function fromFile (text1 As String) As Boolean

Parameters

text1
String

Returns

true if the file operation was successful; otherwise, false.

Remarks

The following are possible values for the encoding parameter that are supplied by the FileEncoding system enumeration:

  • ACP
  • UTF8
  • UTF16BE
  • UTF16LE
  • GB18030
  • AUTO

If the file operation is unsuccessful, the TextBuffer object remains unchanged. If an attacker can control input to the fromFile method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the ExecutePermission class. Make sure that the user has development privileges by setting the security key to SysDevelopment on the control that calls this method.

Applies to

fromFile(String, Int32)

public:
 virtual bool fromFile(System::String ^ _filename, int _encoding);
public virtual bool fromFile (string _filename, int _encoding);
abstract member fromFile : string * int -> bool
override this.fromFile : string * int -> bool
Public Overridable Function fromFile (_filename As String, _encoding As Integer) As Boolean

Parameters

_filename
String

The encoding option to use; optional.

_encoding
Int32

The encoding option to use; optional.

Returns

Applies to