This is a migrated thread and some comments may be shown as answers.

Stop the selection

4 Answers 21 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Krish
Top achievements
Rank 1
Krish asked on 22 Nov 2018, 10:40 AM
Hi
  We are using the below code for autoselect next part for the . this condition is working good. but we need to stop the selection, once the year is entry is done. please find the below Image. kindly help me to solve this
  
  Thanks in advance
 
 Public Sub Datetimetype(DName As RadDateTimePicker)
        Dim provider = TryCast(DName.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider)
        provider.AutoSelectNextPart = True
    End Sub

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 22 Nov 2018, 11:41 AM
Hi Krish,

The image is missing, could you attach it again, please.

I am not sure what is the desired effect. Do you want to make the year read-only?

I am looking forward to your reply.
 
Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Krish
Top achievements
Rank 1
answered on 22 Nov 2018, 01:28 PM

hi Dimitar,

    I am very sorry for the inconvenience. I attach the image. For your reference, I attach the video also. Please find the image and video link. sorry once again.

Video Link: https://Mahaaitech.tinytake.com/sf/MzEwMjAzNl85Mjk4MjM4

0
Dimitar
Telerik team
answered on 23 Nov 2018, 07:27 AM
Hi Krish,

You can use the SelectedItemChanged event of the MaskDateTimeProvider to select the next control. Here is the code:
Public Sub New()
    InitializeComponent()
    radDateTimePicker1.Format = DateTimePickerFormat.Custom
    radDateTimePicker1.CustomFormat = "dd/MM/yyyy"
 
    Dim dtprovider As MaskDateTimeProvider = TryCast(radDateTimePicker1.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider)
    dtprovider.AutoSelectNextPart = True
    AddHandler dtprovider.SelectedItemChanged, AddressOf Dtprovider_SelectedItemChanged1
 
 
End Sub
Private oldSelectedIndex As Integer = -1
Private Sub Dtprovider_SelectedItemChanged1(ByVal sender As Object, ByVal e As EventArgs)
    Dim provider = TryCast(sender, MaskDateTimeProvider)
 
    If oldSelectedIndex <> -1 AndAlso oldSelectedIndex = 4 AndAlso provider.SelectedItemIndex = 0 Then
        radTextBox1.Focus()
    End If
    oldSelectedIndex = provider.SelectedItemIndex
End Sub

Let me know how this works for you.

Regards,
Dimitar
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Krish
Top achievements
Rank 1
answered on 23 Nov 2018, 12:52 PM
Thank you so much, Dimitar. code was working good:)
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Krish
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Krish
Top achievements
Rank 1
Share this question
or