TextChanged event with SpinEditor and DateTimePicker doesn't work

2 posts, 0 answers
  1. Blas
    Blas avatar
    56 posts
    Member since:
    Dec 2007

    Posted 11 May 2010 Link to this post


    I need to enable the update button in a form whenever the value of any control in the form change its value. It works fine for RadTextBox, RadComboBox, but it doesn't work either for RadSpinEditor nor RadDateTimePicker.

     Private Sub Text_Changed(ByVal sender As System.ObjectByVal e As System.EventArgs) _ 
                Handles RadTextBox1.TextChanged, _ 
                        RadComboBox1.TextChanged, _ 
                        RadDateTimePicker1.TextChanged, _ 
            If RadTextBox1.ContainsFocus Or _ 
               RadComboBox1.ContainsFocus Or _ 
               RadDateTimePicker1.ContainsFocus Or _ 
               RadSpinEditor1.ContainsFocus Then 
                 Me.UpdateButton.Enabled = True 
            End If 
        End Sub 

    I tried a more generic way to do it with this procedure, that didn't work too:

    Private Sub Text_Changed(ByVal sender As System.ObjectByVal e As System.EventArgs) _ 
                Handles RadTextBox1.TextChanged, _ 
                        RadComboBox1.TextChanged, _ 
                        RadDateTimePicker1.TextChanged, _ 
            If HasFocus(sender) Then 
                Me.RadButton1.Enabled = True 
            End If 
    End Sub 
    Public Function HasFocus(ByVal sender As System.ObjectAs Boolean 
            Dim radElemento As Telerik.WinControls.RadElement 
            If sender.GetType Is GetType(Telerik.WinControls.UI.RadTextBox) Then 
                radElemento = DirectCast(sender, Telerik.WinControls.UI.RadTextBox).FocusedElement 
            End If 
            If sender.GetType Is GetType(Telerik.WinControls.UI.RadComboBox) Then 
                radElemento = DirectCast(sender, Telerik.WinControls.UI.RadComboBox).FocusedElement 
            End If 
            If sender.GetType Is GetType(Telerik.WinControls.UI.RadSpinEditor) Then 
                radElemento = DirectCast(sender, Telerik.WinControls.UI.RadSpinEditor).FocusedElement 
            End If 
            If sender.GetType Is GetType(Telerik.WinControls.UI.RadDateTimePicker) Then 
                radElemento = DirectCast(sender, Telerik.WinControls.UI.RadDateTimePicker).FocusedElement 
            End If 
            If sender.GetType Is GetType(Telerik.WinControls.UI.RadCheckBox) Then 
                radElemento = DirectCast(sender, Telerik.WinControls.UI.RadCheckBox).FocusedElement 
            End If 
            If Not radElemento Is Nothing AndAlso radElemento.ContainsFocus Then 
                Return True 
                Return False 
            End If 
    End Function 

    Thank you

  2. Dobry Zranchev
    Dobry Zranchev avatar
    353 posts

    Posted 14 May 2010 Link to this post

    Hello Roberto Andrade Olivie,

    Thank you for writing. Please use the ValueChanged event of RadDateTimePicker and RadSpinEditor to address the issue.

    Do not hesitate to contact us if you have other questions.

    Sincerely yours,
    Dobry Zranchev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top