TX Text Control .NET for WPF

IsTextValid Method

Method|Introduced in 29.0
Namespace
TXTextControl.WPF.Barcode
Package
TXTextControl.TextControl.WPF.SDK as TXBarcode.WPF.dll from the private NuGet feed or Text Control Offline Packages

Description

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.

Syntax

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

Parameters

ParameterDescription
barcodeType

Specifies the barcode type 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.

Return Value

True, if the specified text is valid for a specific barcode type. Otherwise false.

Examples

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

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.");
}