TX Text Control .NET for Windows Forms

DateFormField Constructor

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

Description

Initializes a new instance of the DateFormField class.

Syntax

DateFormField(int)

Initializes a new instance of an empty DateFormField. The date is set to January 1, 1601.

public DateFormField(int emptyWidth);
ParameterDescription
emptyWidth

Specifies the horizontal extension, in twips, of the DateFormField, when a date is not set. When this parameter is set to 0, a default value is used.

DateFormField(DateTime, int)

Initializes a new instance of a DateFormField with the specified date.

public DateFormField(DateTime date, int emptyWidth);
ParameterDescription
date

Specifies the date of the DateFormField.

emptyWidth

Specifies the horizontal extension, in twips, of the DateFormField, when a date is not set. When this parameter is set to 0, a default value is used.

Examples

The following example adds a prefilled delivery-date field to a form.

DateFormField dateFormField = new(DateTime.Today.AddDays(14), 0) { Name = "DeliveryDate" };
textControl.FormFields.Add(dateFormField);