SftDate/OCX 2.0 includes sample code for C#, VB.NET and C++/MFC. Even though C samples are not included, the Syntax section for properties, methods and events also shows the C syntax.
The following samples can be found in the folder C:\Program Files (x86)\Softelvdm\SftDate OCX 2.0\Samples. Each sample is installed in its own subdirectory, with a Visual Studio solution and project. The C# and VB.NET samples are .NET Framework 4.8 Windows Forms applications; the C++ samples are MFC dialog applications, supplied with a precompiled 64-bit executable.
| Sample | Description |
|---|---|
| C# DemoSample Sample | Shows labeled date fields of every kind (a date, a long date, a time from a list and from a clock, a date and time, a range, an optional date with a check box, an empty field, a free-form field and a custom format) and a month calendar, with options that change their culture and calendar system, dark mode, high contrast, buttons, border, dropdown alignment, months, week numbers, first day of the week, views, Today and Clear buttons, holidays as special dates, weekends colored in the DayFormatting event, disabled weekends, range selection, limits, a color scheme and themes. |
| C# EventViewer Sample | Logs the events of two date fields and a month calendar. The appointment field refuses Saturdays and Sundays in its ValueValidating event, and the due date field accepts "+7" or "-3" as a number of days from today in its TextParsing event. |
| Sample | Description |
|---|---|
| VB.NET DemoSample Sample | Shows labeled date fields of every kind (a date, a long date, a time from a list and from a clock, a date and time, a range, an optional date with a check box, an empty field, a free-form field and a custom format) and a month calendar, with options that change their culture and calendar system, dark mode, high contrast, buttons, border, dropdown alignment, months, week numbers, first day of the week, views, Today and Clear buttons, holidays as special dates, weekends colored in the DayFormatting event, disabled weekends, range selection, limits, a color scheme and themes. |
| VB.NET EventViewer Sample | Logs the events of two date fields and a month calendar. The appointment field refuses Saturdays and Sundays in its ValueValidating event, and the due date field accepts "+7" or "-3" as a number of days from today in its TextParsing event. |
| Sample | Description |
|---|---|
| C++ DemoSample Sample | The DemoSample as an MFC dialog application, using the controls through ISftDatePtr and ISftCalendarPtr smart pointers, with the events handled through ON_EVENT and ON_EVENT_RANGE. |
| C++ EventViewer Sample | The EventViewer as an MFC dialog application, with the events of the three controls handled through ON_EVENT_RANGE and logged in a list view. |
The Demo application starts the C++ samples from its Samples tab (see Demo Application).