# TXSpellChecker.GetMenuItems Method

> Returns an array of MenuItems, which are used to create a custom spell check ContextMenu.

- **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 > TXSpellChecker.GetMenuItems Method
- **1164 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/getmenuitems-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/getmenuitems-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/getmenuitems-method/llms-full.txt

---

### Description

Returns an array of [MenuItems](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt), which are used to create a custom spell check ContextMenu.

### Syntax

#### GetMenuItems(object, object, int)

Returns an array of [MenuItems](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt) for a specific object of type `TXTextControl.MisspelledWord`.

```csharp
public MenuItem[] GetMenuItems(object misspelledWord, object textControl, int maxSuggestions);
```

```vbnet
Public Function GetMenuItems(misspelledWord As Object, textControl As Object, maxSuggestions As Integer) As MenuItem()
```

| Parameter | Description |
|---|---|
| misspelledWord | The misspelled word of type `TXTextControl.MisspelledWord` for that the array of [menu items](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt) are created. |
| textControl | The control of type `TXTextControl.TextControl` that contains the misspelled word. |
| maxSuggestions | The maximum number of [suggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/suggestions-property/llms-full.txt) that should be created for the incorrect word. |

#### GetMenuItems(IncorrectWord, string, int)

Returns an array of [MenuItems](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt) for a specific [IncorrectWord](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/llms-full.txt).

```csharp
public MenuItem[] GetMenuItems(IncorrectWord incorrectWord, string sourceText, int maxSuggestions);
```

```vbnet
Public Function GetMenuItems(incorrectWord As IncorrectWord, sourceText As String, maxSuggestions As Integer) As MenuItem()
```

| Parameter | Description |
|---|---|
| incorrectWord | The misspelled word of type [IncorrectWord](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/llms-full.txt) for that the array of [menu items](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt) is created. |
| sourceText | The text that contains the misspelled word. |
| maxSuggestions | The maximum number of [suggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/suggestions-property/llms-full.txt) that should be created for the incorrect word. |

### Return Value

The array of type [MenuItem](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/menuitem/llms-full.txt) for the specified misspelled word.

### Examples

The following example retrieves menu items from the txspell checker.

```csharp
TXTextControl.Proofing.MenuItem[] results = tXSpellChecker.GetMenuItems(new TXTextControl.Proofing.IncorrectWord(), "Quarterly results", 10);
foreach (TXTextControl.Proofing.MenuItem menuItem in results)
{
    Console.WriteLine(menuItem);
}
```

```vbnet
Dim results As TXTextControl.Proofing.MenuItem() = tXSpellChecker.GetMenuItems(New TXTextControl.Proofing.IncorrectWord(), "Quarterly results", 10)
For Each menuItem As TXTextControl.Proofing.MenuItem In results
    Console.WriteLine(menuItem)
Next
```

---

## Nearby

- **Previous:** [TXSpellChecker.GetHyphenationPoints Method](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/gethyphenationpoints-method/llms-full.txt)
- **Next:** [TXSpellChecker.HyphenationLanguage Property](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/hyphenationlanguage-property/llms-full.txt)
