# SpellingCorrectionUIProvider.StateManager.SetCurrent Method

> Sets an object of type TXTextControl.TextControl or text for user interface based spelling correction. Furthermore, overloads of the method determine and set a specific incorrect or misspelled (TXTextControl.MisspelledWord) word based on a specific text position to handle it by the SpellingCorrectionUIProvider.

- **Product:** TX Spell .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 6.0
- **Namespace:** `TXTextControl.Proofing`
- **Package:** `TXTextControl.TXSpell.WPF.SDK` (assembly `TXSpell.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TXSpell.Core.SDK` (assembly `TXSpell.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXSpell.dll` from the setup
- **Path:** TX Spell .NET for WPF > Reference > TXTextControl.Proofing > SpellingCorrectionUIProvider.StateManager.SetCurrent Method
- **1180 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/setcurrent-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/setcurrent-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/setcurrent-method/llms-full.txt

---

### Description

Sets an object of type `TXTextControl.TextControl` or text for [user interface based spelling correction](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell/spellingcorrectionuiprovider-property/llms-full.txt). Furthermore, overloads of the method determine and set a specific [incorrect](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) or misspelled (`TXTextControl.MisspelledWord`) word based on a specific text position to handle it by the [SpellingCorrectionUIProvider](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell/spellingcorrectionuiprovider-property/llms-full.txt).

### Syntax

#### SetCurrent(object)

Sets an object of type `TXTextControl.TextControl` as [CurrentTextControl](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/currenttextcontrol-property/llms-full.txt) to handle it by the [SpellingCorrectionUIProvider](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell/spellingcorrectionuiprovider-property/llms-full.txt). If the parameter is not null, the first `TXTextControl.MisspelledWord` of the TextControl is set as [CurrentWordToCorrect](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/currentwordtocorrect-property/llms-full.txt) and the corresponding `TXTextControl.IFormattedText` object as [CurrentIFormattedText](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/currentiformattedtext-property/llms-full.txt). Otherwise the [SpellingCorrectionUIProvider's mode](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/mode-property/llms-full.txt) is reset to [InitialState](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell-spellingcorrectionmode/enumeration/llms-full.txt). If the TXTextControl.TextControl parameter does not contain misspelled words, the mode is set to [NoWordsToCorrectFound](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell-spellingcorrectionmode/enumeration/llms-full.txt).

```csharp
public void SetCurrent(object textControl);
```

```vbnet
Public Sub SetCurrent(textControl As Object)
```

| Parameter | Description |
|---|---|
| textControl | The object of type `TXTextControl.TextControl` that is handled by the SpellingCorrectionUIProvider. |

#### SetCurrent(string)

Sets the text that is handled by the [SpellingCorrectionUIProvider](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell/spellingcorrectionuiprovider-property/llms-full.txt) as [current text](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/currenttext-property/llms-full.txt). If the parameter is not null, the first [incorrect word](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) of the text is set as [CurrentWordToCorrect](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/currentwordtocorrect-property/llms-full.txt). Otherwise the [SpellingCorrectionUIProvider's mode](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/mode-property/llms-full.txt) is reset to [InitialState](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell-spellingcorrectionmode/enumeration/llms-full.txt). If the text parameter does not contain incorrect words, the mode is set to [NoWordsToCorrectFound](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/txspell-spellingcorrectionmode/enumeration/llms-full.txt).

```csharp
public void SetCurrent(string text);
```

```vbnet
Public Sub SetCurrent(text As String)
```

| Parameter | Description |
|---|---|
| text | The text that is handled by the SpellingCorrectionUIProvider. |

### Return Value

SetCurrent methods including a textPosition parameter return true if the corresponding CurrentWordToCorrect property is changed on calling this method. Otherwise false.

### Examples

The following example uses Set Current in a focused State Manager workflow. The created object is then available to the surrounding document workflow.

```csharp
stateManager.SetCurrent("Approved");
Console.WriteLine("State Manager is ready for use.");
```

```vbnet
stateManager.SetCurrent("Approved")
Console.WriteLine("State Manager is ready for use.")
```

### Remarks

Throws an exception if the [IsOptionsSettings](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/isoptionssettings-property/llms-full.txt) property is set to true.

---

## Nearby

- **Previous:** [SpellingCorrectionUIProvider.StateManager.Mode Property](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-statemanager/mode-property/llms-full.txt)
- **Next:** [SpellingCorrectionUIProvider.StateManaging Property](https://docs.textcontrol.com/tx-spell-dotnet-wpf/reference/txtextcontrol-proofing/spellingcorrectionuiprovider/statemanaging-property/llms-full.txt)
