# TextControl.OnBarcodeSelected Method

> Raises the BarcodeSelected event.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 19.0
- **Namespace:** `TXTextControl.WPF`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.WPF.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.WPF.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF > TextControl.OnBarcodeSelected Method
- **539 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/onbarcodeselected-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/onbarcodeselected-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/onbarcodeselected-method/llms-full.txt

---

### Description

Raises the BarcodeSelected event.

### Syntax

```csharp
protected virtual void OnBarcodeSelected(BarcodeEventArgs e);
```

```vbnet
Protected Overridable Sub OnBarcodeSelected(e As BarcodeEventArgs)
```

### Parameters

| Parameter | Description |
|---|---|
| e | Specifies an [BarcodeEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/barcodeeventargs/llms-full.txt) object that contains the event data. |

### Examples

The following example extends Text Control and performs custom processing when On Barcode Selected is invoked.

```csharp
class CustomTextControl : TXTextControl.WPF.TextControl
{
    protected override void OnBarcodeSelected(TXTextControl.DataVisualization.BarcodeEventArgs e)
    {
        // Add custom processing before registered event handlers run.
        base.OnBarcodeSelected(e);
    }
}
```

```vbnet
Class CustomTextControl
    Inherits TXTextControl.WPF.TextControl

    Protected Overrides Sub OnBarcodeSelected(e As TXTextControl.DataVisualization.BarcodeEventArgs)
        ' Add custom processing before registered event handlers run.
        MyBase.OnBarcodeSelected(e)
    End Sub
End Class
```

---

## Nearby

- **Previous:** [TextControl.OnBarcodeRightClicked Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/onbarcoderightclicked-method/llms-full.txt)
- **Next:** [TextControl.OnBarcodeSized Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/onbarcodesized-method/llms-full.txt)
