HeaderPane
Main

Compare

A Windows Forms DateTimePicker that can be empty

The Windows Forms DateTimePicker always holds a date, takes its format from the Windows settings instead of your application, and its calendar cannot mark a holiday or block a weekend. Here is how DateTimePicker and MonthCalendar compare with SftDate/NET 3.0.

The problem

The DateTimePicker is fine for a date every record has. It runs out at the first optional date: its Value is a DateTime and can never be null, so an empty "Shipped on" field needs the ShowCheckBox check box, whose Value still returns a date while the box is cleared, or a blank CustomFormat and code that keeps track of what the field really holds.

More gaps show up as the application grows. The control formats dates in the Windows user's regional settings, not in the culture the application chose. A time is picked with up and down buttons. The dropdown shows one month and cannot mark holidays or rule out weekends, and the MonthCalendar marks dates in bold only. Users enter a date one part at a time and cannot type or paste it as text.

SftDate/NET 3.0 is a date field (SftDate) and a calendar (SftCalendar) for Windows Forms, written entirely in C#, with these features built in.

Feature comparison

FeatureDateTimePickerMonthCalendarSftDate/NET 3.0
Empty valueNo, Value is always a dateNo, a date is always selectedValue is a nullable DateTime: a check box, or an empty field with placeholder text and a Clear button
CultureThe Windows user's regional settingsThe Windows user's regional settingsAny culture, set per control, including the Japanese, Hebrew and Hijri calendars and right-to-left layout
Choosing a timeUp and down buttonsNoA time list or a clock face in the dropdown, alone or beside the calendar
Date rangesNo, two pickersYes, up to MaxSelectionCount daysIn a field or a calendar, any length, by click, Shift+click or dragging
Holidays and appointmentsNoBold datesBold, colors, images and tooltips, recurring weekly, monthly or annually, in the dropdown too
Days that cannot be selectedNo, only MinDate and MaxDateNo, only MinDate and MaxDateDays of the week, single dates, or any rule in an event
Months shownOne in the dropdownSeveralSeveral, in the calendar and in the dropdown
Week numbersNoYesYes, by the culture's rule or ISO 8601
Typing a dateOne part at a timeNoOne part at a time, or the whole date as text, with your own parsing if you need it
Refusing or correcting a value as it is enteredNo, ValueChanged follows the changeNoValueValidating event
ColorsMostly ignored under the Windows themeMostly ignored under the Windows themeEvery color of the field, the calendar and single days

What the code looks like

If you know the DateTimePicker, much of SftDate/NET will look familiar: Value, MinDate, MaxDate, Format and CustomFormat. It is not a drop-in replacement, though: Value is a nullable DateTime and the calendar settings are grouped in the Calendar object. This sets up an optional due date that shows a placeholder while it is empty, marks a holiday, blocks weekends in the calendar and refuses a date in the past:

sftDate1.AllowEmpty = true;
sftDate1.PlaceholderText = "No due date";
sftDate1.ShowClearButton = true;
sftDate1.Value = null;

CalendarClass calendar = sftDate1.Calendar;
calendar.DisabledDaysOfWeek = DaysOfWeekEnum.Weekend;
SpecialDateClass day = calendar.SpecialDates.Add(
    new DateTime(2026, 12, 25), RecurrenceEnum.Annually);
day.ForeColor = Color.Firebrick;
day.ToolTip = "Christmas Day";

private void sftDate1_ValueValidating(object sender, ValueValidatingEventArgs e) {
    if (e.NewValue < DateTime.Today)
        e.Cancel = true;
}

You can also skip most of the code: the controls are placed from the Visual Studio toolbox, and their property pages set up the calendar and the special dates visually. The documentation lists where each DateTimePicker and MonthCalendar function is found in SftDate/NET.

Modern Windows

SftDate/NET 3.0 runs in .NET Framework 4.7 (or later) and .NET 10 (or later) applications, with the same API and Visual Studio designer support in both; in .NET 10 the value is also available as DateOnly and TimeOnly. Set one property and the field, its dropdown and the calendar follow the Windows light/dark setting. The controls scale with the DPI of the monitor showing them, honor the Windows contrast themes and have built-in UI Automation support for Narrator, NVDA, JAWS and other screen readers, dropdown included.

When the DateTimePicker is enough

If a form needs a required date in the user's own regional format and nothing more, the DateTimePicker is fine, and it is free. SftDate/NET earns its place when dates are optional, when the application decides the culture, when users pick times, ranges or days from a calendar that shows holidays and blocks days, or when the field has to match a dark or custom-colored application.

Try it

The free trial includes the working controls and the C# and VB.NET samples. Test them in your own forms before you buy. A license is royalty-free and includes one year of support and upgrades.

SftDate/NET 3.0 and free trial Documentation