# RibbonItemCollection.Contains Method

> Determines whether a control is in the collection.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 24.0
- **Namespace:** `TXTextControl.Windows.Forms.Ribbon`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.Windows.Forms.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Windows.Forms.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl.Windows.Forms.Ribbon > RibbonItemCollection.Contains Method
- **413 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonitemcollection/contains-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonitemcollection/contains-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonitemcollection/contains-method/llms-full.txt

---

### Description

Determines whether a control is in the collection.

### Syntax

```csharp
public bool Contains(Control ribbonItem);
```

```vbnet
Public Function Contains(ribbonItem As Control) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| ribbonItem | The item to locate in this collection. |

### Return Value

True if item is found in this collection. Otherwise, false.

### Examples

The following example checks whether the ribbon item collection contains the requested key.

```csharp
if (ribbonItemCollection.Contains(new System.Windows.Forms.Control()))
{
    Console.WriteLine("Contains completed successfully.");
}
```

```vbnet
If ribbonItemCollection.Contains(New System.Windows.Forms.Control()) Then
    Console.WriteLine("Contains completed successfully.")
End If
```

---

## Nearby

- **Previous:** [RibbonItemCollection.AddRange Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonitemcollection/addrange-method/llms-full.txt)
- **Next:** [RibbonItemCollection.Insert Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonitemcollection/insert-method/llms-full.txt)
