The controls are automatically added to your Toolbox in Visual Studio and are automatically registered in the GAC (Global Assembly Cache) during installation of SftDate/NET. Please see Distributing SftDate/NET for information on how to distribute the controls with your application.
.NET 10 projects use the controls through their NuGet package, see Using SftDate/NET with .NET 10.
You can add an SftDate or SftCalendar control to a form by dragging it from the Toolbox to the form.
If the controls are missing from the Toolbox, please see "Manually Adding .NET Components To The Toolbox".
Once a control has been added to the form, you can access its property pages, product updates and product support page on the web using the control's smart tag. Edit Properties opens the property pages; Calendar... and Special Dates... open them on that page.
Place a Label in front of each field, with a text such as "&Start date:". Screen readers use it as the field's name and its mnemonic moves the input focus to the field (see Accessibility).
In this example, we'll set up a date field and a calendar in code and show the selected date in the form's caption.
VB
Imports Softelvdm.SftDateNET
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SftDate1.Format = DateFormatEnum.LongDate
SftDate1.AllowEmpty = True
SftDate1.PlaceholderText = "No date"
SftDate1.Value = Nothing
SftCalendar1.Calendar.ShowWeekNumbers = True
SftCalendar1.Calendar.SpecialDates.Add(New DateTime(2026, 12, 25), RecurrenceEnum.Annually).ToolTip = "Christmas Day"
End Sub
Private Sub SftCalendar1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SftCalendar1.ValueChanged
SftDate1.Value = SftCalendar1.Value
Text = SftDate1.Text
End Sub
End ClassC#
using System;
using System.Windows.Forms;
using Softelvdm.SftDateNET;
namespace WindowsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
sftDate1.Format = DateFormatEnum.LongDate;
sftDate1.AllowEmpty = true;
sftDate1.PlaceholderText = "No date";
sftDate1.Value = null;
sftCalendar1.Calendar.ShowWeekNumbers = true;
sftCalendar1.Calendar.SpecialDates.Add(new DateTime(2026, 12, 25), RecurrenceEnum.Annually).ToolTip = "Christmas Day";
sftCalendar1.ValueChanged += sftCalendar1_ValueChanged;
}
private void sftCalendar1_ValueChanged(object sender, EventArgs e) {
sftDate1.Value = sftCalendar1.Value;
Text = sftDate1.Text;
}
}
}These controls have many properties and methods which you can use. This is a very simple example and doesn't even begin to exploit their capabilities. Please take a moment to familiarize yourself with the classes and objects offered by SftDate/NET. Also make sure to run the demo which is included with this product and take a look at the included samples.