TX Text Control .NET for Windows Forms

DateFormField Class

Class|Introduced in 28.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Inherits
  1. TextField
  2. FormField
  3. DateFormField

Description

An object of the DateFormField class represents a date field on a form. It can be initially empty and it can have a horizontal extension, when it is empty. When a date field is clicked or entered through the keyboard's arrow keys a date control is shown where the user can select a date. When the date field is clicked again or the Escape key is pressed the date control is removed and the user can insert or change the date with the keyboard. The date is formatted depending on the culture used for the text of the date field. When a date field is inserted at a position without a set culture, a TextControl uses the system language to select a culture. Supported formats for a certain language can be obtained through the DateFormField.SupportedDateFormats property and can be set with the DateFormField.DateFormat property. When the DateFormat property is an empty string, which is the default, the culture's default format is used. A user can also insert or change a date with the keyboard, then the TextControl tries to parse the inserted date depending on the specified format and culture and automatically formats the date. When parsing is not possible the previous date is restored.

Syntax

public class DateFormField : FormField

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);

Members

Constructors

ConstructorDescription
DateFormFieldInitializes a new instance of the DateFormField class.

Properties

PropertyDescription
DateGets or sets the DateFormField's date.
DateFormatGets or sets the date's format. For a certain DateFormField the format string should be one of the strings returned through the SupportedDateFormats property. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date. When this property is an empty string, which is the default value, a default format is used depending on the culture set for the date field's text.
DescriptiveTextGets or sets a descriptive text for a form field. An empty string indicates that the form field has no such text. An empty string can also be used to delete a previously set text. (Inherited from FormField.)
EmptyWidthGets or sets the horizontal extension, in twips, of the DateFormField, when a date is not set.
EnabledGets or set a value indicating whether the form field is enabled. This property has only an effect, when the when the TextControl.EditMode is set to ReadAndSelect and the DocumentPermissions.AllowEditingFormFields property has been set to true. In this case a Formfield can only be edited, when its Enabled property is true. When a FormField is disabled, the TextFieldClicked and TextFieldDoubleClicked of the Formfield are suppressed. The default value of this property is true. (Inherited from FormField.)
IsDateControlVisibleGets or sets a value indicating wheather a date control is shown below the DateFormField so that the user can select a date.
SupportedDateFormatsGets an array of format picture strings which can be used to format the date. The returned format strings depend on the culture set for the date field's text. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date.

Methods

MethodDescription
FormFieldDialogOpens a dialog box to alter the formatting attributes of the form field. (Inherited from FormField.)