# SpellCheckDialogStateManager.SetNext Method

> Provides a method to set a specific incorrect or misspelled (TXTextControl.MisspelledWord) word, that should be handled next by the SpellCheckDialog. Furthermore, a complete new text or an object of type TXTextControl.TextControl can be set to the SpellCheckDialog. A new incorrect word or misspelled word (TXTextControl.IFormattedText.MisspelledWords) collection is connected and handled.

- **Product:** TX Spell .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 3.0
- **Namespace:** `TXTextControl.Proofing`
- **Package:** `TXTextControl.TXSpell.WinForms.SDK` (assembly `TXSpell.Windows.Forms.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXSpell.Windows.Forms.dll` from the setup
- **Path:** TX Spell .NET for Windows Forms > Reference > TXTextControl.Proofing > SpellCheckDialogStateManager.SetNext Method
- **1330 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialogstatemanager/setnext-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialogstatemanager/setnext-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialogstatemanager/setnext-method/llms-full.txt

---

### Description

Provides a method to set a specific [incorrect](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) or misspelled (`TXTextControl.MisspelledWord`) word, that should be handled next by the SpellCheckDialog. Furthermore, a complete new text or an object of type `TXTextControl.TextControl` can be set to the SpellCheckDialog. A new [incorrect word](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectwordcollection/llms-full.txt) or misspelled word (`TXTextControl.IFormattedText.MisspelledWords`) collection is connected and handled.

### Syntax

#### SetNext(string)

Sets the text that should be handled next by the SpellCheckDialog.

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

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

| Parameter | Description |
|---|---|
| text | The text that should be handled next by the SpellCheckDialog. |

#### SetNext(IncorrectWord)

Sets the [incorrect word](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) that should be handled next by the SpellCheckDialog.

```csharp
public void SetNext(IncorrectWord incorrectWord);
```

```vbnet
Public Sub SetNext(incorrectWord As IncorrectWord)
```

| Parameter | Description |
|---|---|
| incorrectWord | The object of type [IncorrectWord](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) that should be handled next by the SpellCheckDialog. It must be part of the [incorrect word collection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/incorrectwords-property/llms-full.txt) that was created by calling the SetNext method with a string parameter or connected by invoking the SpellCheckDialog with the first or second overload of the [TXSpellChecker.SpellCheckDialog.Show](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialog/show-method/llms-full.txt) method. |

#### SetNext(object)

Sets an object of type `TXTextControl.TextControl` that should be handled next by the SpellCheckDialog.

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

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

| Parameter | Description |
|---|---|
| textControl | The object of type `TXTextControl.TextControl` that should be handled next by the SpellCheckDialog. |

#### SetNext(object, object)

Sets an object of type `TXTextConrol.MisspelledWord` that should be handled next by the SpellCheckDialog.

```csharp
public void SetNext(object misspelledWord, object iFormattedText);
```

```vbnet
Public Sub SetNext(misspelledWord As Object, iFormattedText As Object)
```

| Parameter | Description |
|---|---|
| misspelledWord | The object of type `TXTextControl.MisspelledWord` that should be handled next by the SpellCheckDialog. |
| iFormattedText | The object of type `TXTextControl.IFormattedText` that contains the misspelled word (`TXTextControl.MisspelledWord`). |

### Examples

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

```csharp
spellCheckDialogStateManager.SetNext("Approved", "Approved");
Console.WriteLine("Spell Check Dialog State Manager is ready for use.");
```

```vbnet
spellCheckDialogStateManager.SetNext("Approved", "Approved")
Console.WriteLine("Spell Check Dialog State Manager is ready for use.")
```

### Remarks

An exception is thrown for the second overload, if the SpellCheckDialog is connected to an instance of `TXTextControl.WPF.TextControl`.

An exception is thrown for the fourth overload, if the SpellCheckDialog is not connected to an instance of `TXTextControl.TextControl` object of which `TextPartCollection` contains the `iFormattedText` parameter.

---

## Nearby

- **Previous:** [SpellCheckDialogStateManager.NextMisspelledWord Property](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialogstatemanager/nextmisspelledword-property/llms-full.txt)
- **Next:** [SpelledWord Class](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spelledword/llms-full.txt)
