I am facing issue with RadDateTimePicker.Is it possible to enter only two digit in the year part like if i enter 16 than it will be consider as 2016 not to enter 2016? If i enter 16 than it will consider as 2016 and if i enter 2016 than it will consider same 2016. please check below code i used for RadDateTimePicker
Public Sub New()
Me.New()
Me.CustomFormat = "MM/dd/yyyy"
AddHandler Me.LostFocus, AddressOf radDateTimePicker1_LostFocus
Me.Font = New System.Drawing.Font("Tahoma", 8.25!)
Me.Format = System.Windows.Forms.DateTimePickerFormat.Custom
Me.NullText = " / /"
Me.Size = New System.Drawing.Size(80, 19)
Me.Value = New Date(CType(0, Long))
CType(Me.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.FirstDayOfWeek = FirstDayOfWeek.Monday
CType(Me.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider).AutoSelectNextPart = True
End Sub
Private Sub radDateTimePicker1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Try
If (Me.Value = "#12:00:00 AM#" Or Date.MinValue = Me.Value.ToShortDateString() Or Me.Value.Year <= 1900) Then
Me.NullableValue = Date.MinValue
Me.NullText = " / /"
End If
Catch ex As Exception
End Try
End Sub
Public Sub New()
Me.New()
Me.CustomFormat = "MM/dd/yyyy"
AddHandler Me.LostFocus, AddressOf radDateTimePicker1_LostFocus
Me.Font = New System.Drawing.Font("Tahoma", 8.25!)
Me.Format = System.Windows.Forms.DateTimePickerFormat.Custom
Me.NullText = " / /"
Me.Size = New System.Drawing.Size(80, 19)
Me.Value = New Date(CType(0, Long))
CType(Me.DateTimePickerElement.GetCurrentBehavior(), RadDateTimePickerCalendar).Calendar.FirstDayOfWeek = FirstDayOfWeek.Monday
CType(Me.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider).AutoSelectNextPart = True
End Sub
Private Sub radDateTimePicker1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Try
If (Me.Value = "#12:00:00 AM#" Or Date.MinValue = Me.Value.ToShortDateString() Or Me.Value.Year <= 1900) Then
Me.NullableValue = Date.MinValue
Me.NullText = " / /"
End If
Catch ex As Exception
End Try
End Sub