HeaderPane
Main
Hide
Share Link
Print

Value Property, SftCalendar Object

Defines the selected date, or the first date of a range; Null when there is none.

Syntax

Get

C#object Date = object.Value;
VB.NETDate = object.Value As Object
C++_variant_t Date = object->Value;
_variant_t Date = object->GetValue();
CHRESULT object->get_Value(VARIANT* Date);

Put

C#object object.Value = Date;
VB.NETobject.Value = Date As Object
C++_variant_t object->Value = Date;
void object->PutValue(const _variant_t& Date);
CHRESULT object->put_Value(VARIANT Date);

object

A SftCalendar object.

Date

Defines the selected date, or the first date of a range; Null when there is none.

Comments

The Value property defines the selected date of the month calendar control. Its time is always 00:00:00. A new control has no selected date and the value is Null. p Setting Null removes the selection. In .NET, Null is DBNull.Value; null (Nothing) also removes the selection. p In range selection mode (SelectionMode), the value is the first date of the range (RangeStart); setting it selects a range of one day. p A date outside the range defined by MinDate and MaxDate causes an error. When the value changes, the control raises the ValueChanged event. The date that has the keyboard focus is a separate setting (FocusedDate).

Examples

C# View entire sample code

        private void ShowSelection() {
            string text = "Selected: (none)";
            if (sftCalendar.SelectionMode == SftDateSelectionModeConstants.selectionSftDateRange) {
                if (sftCalendar.RangeStart is DateTime) {
                    DateTime start = (DateTime)sftCalendar.RangeStart;
                    DateTime end = sftCalendar.RangeEnd is DateTime ? (DateTime)sftCalendar.RangeEnd : start;
                    text = "Selected: " + FormatLongDate(start) + " - " + FormatLongDate(end);
                }
            } else if (sftCalendar.Value is DateTime)
                text = "Selected: " + FormatLongDate((DateTime)sftCalendar.Value);
            labelSelection.Text = text;
        }

        private void sftCalendar_ValueChanged(object sender, EventArgs e) {
            ShowSelection();
        }

VB.NET View entire sample code

    Private Sub ShowSelection()
        Dim selection As String = "Selected: (none)"
        If sftCalendar.SelectionMode = SftDateSelectionModeConstants.selectionSftDateRange Then
            If TypeOf sftCalendar.RangeStart Is Date Then
                Dim start As Date = CDate(sftCalendar.RangeStart)
                Dim [end] As Date = If(TypeOf sftCalendar.RangeEnd Is Date, CDate(sftCalendar.RangeEnd), start)
                selection = "Selected: " & FormatLongDate(start) & " - " & FormatLongDate([end])
            End If
        ElseIf TypeOf sftCalendar.Value Is Date Then
            selection = "Selected: " & FormatLongDate(CDate(sftCalendar.Value))
        End If
        labelSelection.Text = selection
    End Sub

    Private Sub sftCalendar_ValueChanged(sender As Object, e As EventArgs) Handles sftCalendar.ValueChanged, sftCalendar.RangeChanged
        ShowSelection()

See Also SftCalendar Object | Object Hierarchy | Values


Last Updated 11/29/2026 - (email)
© 2026 Softel vdm, Inc.