# TextViewGenerator.BarcodeSelected Event

> Occurs when a barcode has been selected. The event handler receives an argument of type BarcodeEventArgs containing data related to this event.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Event
- **Introduced:** 21.0
- **Namespace:** `TXTextControl.ServerVisualisation`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Server.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.Server.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Server.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.ServerVisualization > TextViewGenerator.BarcodeSelected Event
- **321 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/textviewgenerator/barcodeselected-event/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/textviewgenerator/barcodeselected-event/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/textviewgenerator/barcodeselected-event/llms-full.txt

---

### Description

Occurs when a barcode has been selected. The event handler receives an argument of type [BarcodeEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-datavisualization/barcodeeventargs/llms-full.txt) containing data related to this event.

### Syntax

```csharp
public event BarcodeEventHandler BarcodeSelected;
```

```vbnet
Public Event BarcodeSelected As BarcodeEventHandler
```

### Examples

The following example records useful context when barcode selected occurs.

```csharp
textViewGenerator.BarcodeSelected += (sender, e) =>
{
    Console.WriteLine($"Barcode Selected at {DateTime.Now:u}");
};
```

```vbnet
AddHandler textViewGenerator.BarcodeSelected,
    Sub(sender, e)
        Console.WriteLine($"Barcode Selected at {DateTime.Now:u}")
    End Sub
```

---

## Nearby

- **Previous:** [TextViewGenerator.BarcodeDeselected Event](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/textviewgenerator/barcodedeselected-event/llms-full.txt)
- **Next:** [TextViewGenerator.BeginUndoAction Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/textviewgenerator/beginundoaction-method/llms-full.txt)
