# TXBarcodeControl.IsTextValid Method

> Returns a value whether the specified text is valid for a specific barcode type. In case of invalid text an appropriate exception message is saved into the specified string.

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

---

### Description

Returns a value whether the specified text is valid for a specific [barcode type](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-barcode/barcodetype/enumeration/llms-full.txt). In case of invalid text an appropriate exception message is saved into the specified string.

### Syntax

```csharp
public static bool IsTextValid(BarcodeType barcodeType, string text, out string errorMessage);
```

```vbnet
Public Shared Function IsTextValid(barcodeType As BarcodeType, text As String, ByRef errorMessage As String) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| barcodeType | Specifies the [barcode type](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-barcode/barcodetype/enumeration/llms-full.txt) for which the text is checked. |
| text | Specifies the text to check. |
| errorMessage | Specifies the string into which an appropriate exception message is saved, if the checked text is not valid for a specific [barcode type](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-barcode/barcodetype/enumeration/llms-full.txt). |

### Return Value

True, if the specified text is valid for a specific [barcode type](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-barcode/barcodetype/enumeration/llms-full.txt). Otherwise false.

### Examples

The following example checks whether text valid applies to the txbarcode control.

```csharp
string errorMessage = "Quarterly report";
if (TXTextControl.WPF.Barcode.TXBarcodeControl.IsTextValid(TXTextControl.Barcode.BarcodeType.QRCode, "Quarterly results", out errorMessage))
{
    Console.WriteLine("Is Text Valid completed successfully.");
}
```

```vbnet
Dim errorMessage As String = "Quarterly report"
If TXTextControl.WPF.Barcode.TXBarcodeControl.IsTextValid(TXTextControl.Barcode.BarcodeType.QRCode, "Quarterly results", errorMessage) Then
    Console.WriteLine("Is Text Valid completed successfully.")
End If
```

---

## Nearby

- **Previous:** [TXBarcodeControl.GetMinimumTextLength Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/getminimumtextlength-method/llms-full.txt)
- **Next:** [TXBarcodeControl.Load Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/load-method/llms-full.txt)
