# TextControl.Find Method

> Finds a text string in the text part with the input focus. This can be the main text, a text frame or a header or footer.

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

---

### Description

Finds a text string in the text part with the input focus. This can be the main text, a text frame or a header or footer.

### Syntax

#### Find()

Opens the built-in Find dialog box to search for a text string in the text part with the input focus. This can be the main text, a text frame or a header or footer.

```csharp
public void Find();
```

```vbnet
Public Sub Find()
```

#### Find(string)

Searches for the specified text string in the text part with the input focus. This can be the main text, a text frame or a header or footer. The search starts at the beginning of the text.

```csharp
public int Find(string text);
```

```vbnet
Public Function Find(text As String) As Integer
```

| Parameter | Description |
|---|---|
| text | Specifies the text to search for. |

#### Find(string, int, FindOptions)

Searches for the specified text string in the text part with the input focus. This can be the main text, a text frame or a header or footer. The search is done with the specified find options and starts at the specified position.

```csharp
public int Find(string text, int start, FindOptions options);
```

```vbnet
Public Function Find(text As String, start As Integer, options As FindOptions) As Integer
```

| Parameter | Description |
|---|---|
| text | Specifies the text to search for. |
| start | Specifies the text position where the search starts, beginning with 0. If this value is -1, the search begins at the current text input position. |
| options | Specifies search options. It can be a combination of the [FindOptions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/findoptions/enumeration/llms-full.txt) values. |

### Return Value

If the text searched for is found, the method returns the index (zero-based) of the first character of the search string. If the specified text is not found the method returns -1.

### Examples

The following example searches for text and handles the returned position.

```csharp
int position = textControl.Find("Quarterly results");
if (position >= 0)
{
    Console.WriteLine($"Found at position {position}.");
}
```

```vbnet
Dim position As Integer = textControl.Find("Quarterly results")
If position >= 0 Then
    Console.WriteLine($"Found at position {position}.")
End If
```

---

## Nearby

- **Previous:** [TextControl.FieldCursor Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/fieldcursor-property/llms-full.txt)
- **Next:** [TextControl.FontDialog Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/fontdialog-method/llms-full.txt)
