HeaderPane
Main
Hide
Share Link
Print

ToString Method, CalendarClass Class

Returns a string that represents the object.

Class: CalendarClass
Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Syntax

public override string ToString();
Public Overrides Function ToString() As String

Return Value

An empty string; the property grid shows the settings below the property.

Comments

Returns a string that represents the object.

Examples

C# View entire sample code

            ShowSelection();
        }

        private void ShowSelection() {
            CultureInfo culture = sftCalendar1.Culture ?? CultureInfo.CurrentCulture;
            string text;
            if (sftCalendar1.SelectionMode == SelectionModeEnum.Range)
                text = sftCalendar1.RangeStart.HasValue
                    ? sftCalendar1.RangeStart.Value.ToString("D", culture) + " - " + (sftCalendar1.RangeEnd ?? sftCalendar1.RangeStart).Value.ToString("D", culture)
                    : "(none)";
            else
                text = sftCalendar1.Value.HasValue ? sftCalendar1.Value.Value.ToString("D", culture) : "(none)";
            labelSelection.Text = "Selected: " + text;
        }
    }
}

VB.NET View entire sample code

    End Sub

    Private Sub ShowSelection()
        Dim culture As CultureInfo = If(SftCalendar1.Culture, CultureInfo.CurrentCulture)
        Dim text As String
        If SftCalendar1.SelectionMode = SelectionModeEnum.Range Then
            If SftCalendar1.RangeStart.HasValue Then
                Dim last As DateTime = If(SftCalendar1.RangeEnd, SftCalendar1.RangeStart).Value
                text = SftCalendar1.RangeStart.Value.ToString("D", culture) + " - " + last.ToString("D", culture)
            Else
                text = "(none)"
            End If
        Else
            text = If(SftCalendar1.Value.HasValue, SftCalendar1.Value.Value.ToString("D", culture), "(none)")
        End If
        LabelSelection.Text = "Selected: " + text

See Also CalendarClass Class | Classes | SftDate/NET 3.0