# TextControl.Load Method

> Loads text in a certain format. The complete contents of a Text Control are replaced.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.Windows.Forms.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Windows.Forms.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > TextControl.Load Method
- **3139 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/load-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/load-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/load-method/llms-full.txt

---

### Description

Loads text in a certain format. The complete contents of a Text Control are replaced.

### Syntax

#### Load()

Opens a file `Open...` dialogbox to select a file and loads the text from that file.

```csharp
public System.Windows.Forms.DialogResult Load();
```

```vbnet
Public Function Load() As System.Windows.Forms.DialogResult
```

#### Load(StreamType)

Opens a file `Open...` dialogbox to select a file and loads the text from that file. The dialogbox offers the specified file format filters.

```csharp
public System.Windows.Forms.DialogResult Load(StreamType streamType);
```

```vbnet
Public Function Load(streamType As StreamType) As System.Windows.Forms.DialogResult
```

| Parameter | Description |
|---|---|
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |

#### Load(StreamType, LoadSettings)

Opens a file `Open...` dialogbox to select a file and loads the text from that file using the specified special settings. The dialogbox offers the specified file format filters.

```csharp
public System.Windows.Forms.DialogResult Load(StreamType streamType, LoadSettings loadSettings);
```

```vbnet
Public Function Load(streamType As StreamType, loadSettings As LoadSettings) As System.Windows.Forms.DialogResult
```

| Parameter | Description |
|---|---|
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |
| loadSettings | Specifies a [LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/llms-full.txt) object with additional information and settings for the load operation. |

#### Load(string, StreamType)

Loads text formatted with the specified format. The new text is read from the specified file.

```csharp
public void Load(string path, StreamType streamType);
```

```vbnet
Public Sub Load(path As String, streamType As StreamType)
```

| Parameter | Description |
|---|---|
| path | Specifies a file from which the data is loaded. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |

#### Load(FileStream, StreamType)

Loads text formatted with the specified format. The new text is read from the specified file stream.

```csharp
public void Load(FileStream fileStream, StreamType streamType);
```

```vbnet
Public Sub Load(fileStream As FileStream, streamType As StreamType)
```

| Parameter | Description |
|---|---|
| fileStream | Specifies a file from which the data is loaded. The data is loaded from the stream's current position. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |

#### Load(byte\[\], BinaryStreamType)

Loads text formatted with the specified format. The new text is read from the specified byte array.

```csharp
public void Load(byte[] binaryData, BinaryStreamType binaryStreamType);
```

```vbnet
Public Sub Load(binaryData As Byte(), binaryStreamType As BinaryStreamType)
```

| Parameter | Description |
|---|---|
| binaryData | Specifies a byte array from which the data is loaded. |
| binaryStreamType | Specifies one of the [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) values. |

#### Load(string, StringStreamType)

Loads text formatted with the specified format. The new text is read from the specified string.

```csharp
public void Load(string stringData, StringStreamType stringStreamType);
```

```vbnet
Public Sub Load(stringData As String, stringStreamType As StringStreamType)
```

| Parameter | Description |
|---|---|
| stringData | Specifies a string from which the data is loaded. |
| stringStreamType | Specifies one of the [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/stringstreamtype/enumeration/llms-full.txt) values. |

#### Load(string, StreamType, LoadSettings)

Loads text formatted with the specified format. The new text is read from the specified file and loaded using the given special settings.

```csharp
public void Load(string path, StreamType streamType, LoadSettings loadSettings);
```

```vbnet
Public Sub Load(path As String, streamType As StreamType, loadSettings As LoadSettings)
```

| Parameter | Description |
|---|---|
| path | Specifies a file from which the data is loaded. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |
| loadSettings | Specifies a [LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/llms-full.txt) object with additional information and settings for the load operation. |

#### Load(FileStream, StreamType, LoadSettings)

Loads text formatted with the specified format. The new text is read from the specified file stream and loaded using the given special settings.

```csharp
public void Load(FileStream fileStream, StreamType streamType, LoadSettings loadSettings);
```

```vbnet
Public Sub Load(fileStream As FileStream, streamType As StreamType, loadSettings As LoadSettings)
```

| Parameter | Description |
|---|---|
| fileStream | Specifies a file from which the data is loaded. The data is loaded from the stream's current position. |
| streamType | Specifies one of the [StreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/streamtype/enumeration/llms-full.txt) values. |
| loadSettings | Specifies a [LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/llms-full.txt) object with additional information and settings for the load operation. |

#### Load(byte\[\], BinaryStreamType, LoadSettings)

Loads text formatted with the specified format. The new text is read from the specified byte array and loaded using the given special settings.

```csharp
public void Load(byte[] binaryData, BinaryStreamType binaryStreamType, LoadSettings loadSettings);
```

```vbnet
Public Sub Load(binaryData As Byte(), binaryStreamType As BinaryStreamType, loadSettings As LoadSettings)
```

| Parameter | Description |
|---|---|
| binaryData | Specifies a byte array from which the data is loaded. |
| binaryStreamType | Specifies one of the [BinaryStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/binarystreamtype/enumeration/llms-full.txt) values. |
| loadSettings | Specifies a [LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/llms-full.txt) object with additional information and settings for the load operation. |

#### Load(string, StringStreamType, LoadSettings)

Loads text formatted with the specified format. The new text is read from the specified string and loaded using the given special settings.

```csharp
public void Load(string stringData, StringStreamType stringStreamType, LoadSettings loadSettings);
```

```vbnet
Public Sub Load(stringData As String, stringStreamType As StringStreamType, loadSettings As LoadSettings)
```

| Parameter | Description |
|---|---|
| stringData | Specifies a string from which the data is loaded. |
| stringStreamType | Specifies one of the [StringStreamType](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/stringstreamtype/enumeration/llms-full.txt) values. |
| loadSettings | Specifies a [LoadSettings](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/loadsettings/llms-full.txt) object with additional information and settings for the load operation. |

### Return Value

The implementations that open a dialog box return the dialog's result value.

### Examples

The following example loads a small RTF document directly from an in-memory string.

```csharp
string rtf = @"{\rtf1\ansi\b Quarterly results\b0\par Revenue increased by 12%.}";
textControl.Load(rtf, StringStreamType.RichTextFormat);
```

```vbnet
Dim rtf As String = "{\rtf1\ansi\b Quarterly results\b0\par Revenue increased by 12%.}"
textControl.Load(rtf, StringStreamType.RichTextFormat)
```

---

## Nearby

- **Previous:** [TextControl.ListFormatDialog Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/listformatdialog-method/llms-full.txt)
- **Next:** [TextControl.MainTextActivated Event](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/maintextactivated-event/llms-full.txt)
