# DateFormField Constructor

> Initializes a new instance of the DateFormField class.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Constructor
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > DateFormField Constructor
- **685 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/dateformfield/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/dateformfield/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/dateformfield/constructor/llms-full.txt

---

### 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.

```csharp
public DateFormField(int emptyWidth);
```

```vbnet
Public Sub New(emptyWidth As Integer)
```

| Parameter | Description |
|---|---|
| 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.

```csharp
public DateFormField(DateTime date, int emptyWidth);
```

```vbnet
Public Sub New([date] As DateTime, emptyWidth As Integer)
```

| Parameter | Description |
|---|---|
| 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.

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

```vbnet
Dim dateFormField As New DateFormField(Date.Today.AddDays(14), 0) With { .Name = "DeliveryDate" }
textControl.FormFields.Add(dateFormField)
```

---

## Nearby

- **Previous:** [DateFormField Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/dateformfield/llms-full.txt)
- **Next:** [DateFormField.Date Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/dateformfield/date-property/llms-full.txt)
