TX Text Control ActiveX

Load Method

Method

Loads text in a certain format from a file and inserts it into the Text Control.

Syntax

TXTextControl.Load FileName[, Offset[, Format[, CurSelection]]]

Parameters

ParameterDescription
FileNameSpecifies the file to load from.
OffsetOptional. Specifies the file position from where the data is read. When not specified or set to zero the data is read from the beginning.
FormatOptional. Specifies a format identifier. When not specified Text Control assumes Text Control's internal format (3). Otherwise it can be one of the following values:
CurSelectionOptional. When set to true the loaded data replaces the current selection or is inserted at the current input position. The new input position is behind the inserted data. When omitted or set to false the loaded data replaces the complete control contents independent of the current selection. The new input position is at the beginning of the data.

Format

ConstantDescription
1 - ANSI textText in Windows ANSI format (an end of a paragraph is marked with the control characters 13 and 10).
2 - TX textText in ANSI format (an end of a paragraph is marked only with the control character 10).
3 - TXText including formatting attributes in the internal Text Control format. Text is stored in ANSI.
4 - HTMLHTML format (Hypertext Markup Language).
5 - RTFRTF format (Rich Text Format).
6 - Unicode textText in Windows Unicode format (an end of a paragraph is marked with the control characters 13 and 10).
7 - TX textText in Unicode format (an end of a paragraph is marked only with the control character 10).
8 - TXText including formatting attributes in the internal Text Control format. Text is stored in Unicode.
9 - Microsoft Word 97-2003Microsoft Word 97-2003 format (*.doc).
10 - XMLXML format (Extensible Markup Language).
11 - CSSCSS format (Cascading Style Sheet).
13 - Microsoft WordMicrosoft Word format (*.docx).
15 - SpreadsheetMLSpreadsheetML format (*.xlsx).

Return Value

The method returns the position in the file after the data has been loaded.

Data Types

NameData type
FileNameString
OffsetLong
FormatInteger
CurSelectionBoolean
Return valueLong

Examples

This Basic example opens a file and loads its contents into TXTextControl1:

Private Sub mnuFile_Load_Click()
   On Error Resume Next
   ' Create an "Open File" dialog box
   CommonDialog1.Filter = "TX Demo (*.tx)|*.tx"
   CommonDialog1.DialogTitle = "Open"
   CommonDialog1.Flags = cdlOFNFileMustExist Or _
      cdlOFNHideReadOnly
   CommonDialog1.CancelError = True
   CommonDialog1.ShowOpen
   If Err Then Exit Sub
   ' Pass the filename to the text control
   TXTextControl1.Load CommonDialog1.filename
End Sub

See Also