property CalendarCombo.SelDate as Date
Selects a date.

 TypeDescription 
   Date A DATE expression that is selected  

The SelDate property indicates the selected date. The Value property is identical with the SelDate property. The Date property specifies the date being browsed in the drop down portion of the control. Use the MaskOnEmpty property to specify the caption being displayed in the control's label when the SelDate property is empty. The SelectionChanged event is fired if the user changes the browsed date. Use the FirstVisibleDate property to get the first visible date. Use the LastVisibleDate property to get the last visible date.

In VB/NET or C# you may need to use the Nothing, null or Date.FromOADate(0) to convert the 0 value to a null date. 

For instance,

The following VB sample set the SelDate property on empty, when the user presses the Delete key: ( displays an empty date )

Private Sub CalendarCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
    If (KeyCode = vbKeyDelete) Then
        CalendarCombo1.SelDate = 0
    End If
End Sub 

or

Private Sub CalendarCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
    If (KeyCode = vbKeyDelete) Then
        CalendarCombo1.Value = 0
    End If
End Sub

or

Private Sub CalendarCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
    If (KeyCode = vbKeyDelete) Then
        CalendarCombo1 = 0
    End If
End Sub

The following VB sample changes the initialization date, when the user presses a key, while the control displays an empty date:

Private Sub CalendarCombo1_KeyPress(KeyAscii As Integer)
    If (CalendarCombo1 = 0) Then
        CalendarCombo1 = "31/12/1971"
    End If
End Sub

or

Private Sub CalendarCombo1_KeyPress(KeyAscii As Integer)
    If (CalendarCombo1 = 0) Then
        CalendarCombo1.SelDate = "31/12/1971"
    End If
End Sub

or

Private Sub CalendarCombo1_KeyPress(KeyAscii As Integer)
    If (CalendarCombo1 = 0) Then
        CalendarCombo1.Value = "31/12/1971"
    End If
End Sub

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.