Unplanned
Last Updated: 10 Jun 2024 13:25 by ADMIN
Riziq
Created on: 10 Jun 2024 13:04
Category: DateTimePicker
Type: Bug Report
1
RadDateTimePicker: ArabicMaskDateTimeProvider accepts non-numeric values when type into the year part

To reproduce the issue:
1. Add a RadDateTimePicker control to a Windows Forms application.
2. Use the "ar-SA" culture.
3. Attempt to manually enter a date in the RadDateTimePicker control using letters or special characters.

Dim hijriCulture As New CultureInfo("ar-SA")
hijriCulture.DateTimeFormat.Calendar = New HijriCalendar()
RadDateTimePicker1.Format = DateTimePickerFormat.Custom
RadDateTimePicker1.Culture = hijriCulture

1 comment
ADMIN
Nadya | Tech Support Engineer
Posted on: 10 Jun 2024 13:25

Hello, Riziq,

Thank you for reporting this.

Currently, you can use the following workaround when using the Arabic culture:

Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider = New MyArabicMaskDateTimeProvider(Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.Mask, Me.RadDateTimePicker1.Culture, Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement)

Public Class MyArabicMaskDateTimeProvider
    Inherits ArabicMaskDateTimeProvider

    Public Sub New(mask As String, culture As CultureInfo, owner As RadMaskedEditBoxElement)
        MyBase.New(mask, culture, owner)
    End Sub

    Protected Overrides Function HandleKeyPress(part As MaskPart, e As KeyPressEventArgs) As Boolean
        Dim value As Integer = 0
        If Not Integer.TryParse(e.KeyChar.ToString(), value) Then
            Return True
        End If

        Return MyBase.HandleKeyPress(part, e)
    End Function
End Class

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.