# DialogButtonCollection.Add Method

> Adds an object of type DialogButton to the collection.

- **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 > DialogButtonCollection.Add Method
- **491 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/add-method/llms-full.txt

---

### Description

Adds an object of type [DialogButton](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbutton/llms-full.txt) to the [collection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/llms-full.txt).

### Syntax

```csharp
public int Add(DialogButton button);
```

```vbnet
Public Function Add(button As DialogButton) As Integer
```

### Parameters

| Parameter | Description |
|---|---|
| button | Specifies an object of type [DialogButton](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbutton/llms-full.txt). |

### Examples

The following example adds an item to the dialog button collection.

```csharp
var result = dialogButtonCollection.Add(new TXTextControl.Proofing.DialogButton(TXTextControl.Proofing.TXSpell.ButtonType.AddToDictionary));
Console.WriteLine($"Add result: {result}");
```

```vbnet
Dim result = dialogButtonCollection.Add(New TXTextControl.Proofing.DialogButton(TXTextControl.Proofing.TXSpell.ButtonType.AddToDictionary))
Console.WriteLine($"Add result: {result}")
```

### Remarks

This method throws an exception when called while the SpellCheckDialog is open.

---

## Nearby

- **Previous:** [DialogButtonCollection Class](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/llms-full.txt)
- **Next:** [DialogButtonCollection.AddRange Method](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/dialogbuttoncollection/addrange-method/llms-full.txt)
