# TextPartCollection.Activate Method

> Sets the input focus to the specified text part. If the activated text part is not in the visible part of the document, the document is scrolled.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 16.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > TextPartCollection.Activate Method
- **526 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textpartcollection/activate-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textpartcollection/activate-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textpartcollection/activate-method/llms-full.txt

---

### Description

Sets the input focus to the specified text part. If the activated text part is not in the visible part of the document, the document is scrolled.

### Syntax

```csharp
public bool Activate(object textPart);
```

```vbnet
Public Function Activate(textPart As Object) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| textPart | Specifies the object to activate. It must be an object of the type [MainText](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/maintext/llms-full.txt), [TextFrame](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textframe/llms-full.txt) or [HeaderFooter](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/headerfooter/llms-full.txt). |

### Return Value

The return value is true, if the specified text part could be activated. Otherwise it is false.

### Examples

The following example works with text parts in the current document by using `TextPartCollection.Activate`.

```csharp
TextPartCollection textPartCollection = textControl.TextParts;

if (textPartCollection.Activate("Approved"))
{
    Console.WriteLine("Activate completed successfully.");
}
```

```vbnet
Dim textPartCollection As TextPartCollection = textControl.TextParts

If textPartCollection.Activate("Approved") Then
    Console.WriteLine("Activate completed successfully.")
End If
```

---

## Nearby

- **Previous:** [TextPartCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textpartcollection/llms-full.txt)
- **Next:** [TextPartCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textpartcollection/copyto-method/llms-full.txt)
