TX Text Control .NET Server

SelectionFormField Constructor

Constructor|Introduced in 28.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Initializes a new instance of the SelectionFormField class.

Syntax

SelectionFormField(int)

Initializes a new instance of an empty SelectionFormField. It has no items and no text.

public SelectionFormField(int emptyWidth);
ParameterDescription
emptyWidth

Specifies the horizontal extension, in twips, of the SelectionFormField, when there is no selected item. When this parameter is set to 0, a default value is used.

SelectionFormField(string[], int)

Initializes a new instance of a SelectionFormField with the specified items and the index of the selected item.

public SelectionFormField(string[] items, int selectedIndex);
ParameterDescription
items

Specifies a list of items for the SelectionFormField.

selectedIndex

Specifies the zero-based index of the selected item. When this parameter is -1, no item is selected.

Examples

The following example adds a country selector to a fillable form.

SelectionFormField selectionFormField = new(new[] { "Germany", "United Kingdom", "United States" }, 0) { Name = "Country" };
textControl.FormFields.Add(selectionFormField);