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

TextChanged event with SpinEditor and DateTimePicker doesn't work

1 Answer 223 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Blas
Top achievements
Rank 1
Blas asked on 11 May 2010, 11:58 AM
Hello

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, _ 
                    RadSpinEditor1.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, _ 
                    RadSpinEditor1.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 
        Else 
            Return False 
        End If 
End Function 

Thank you



1 Answer, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 14 May 2010, 01:47 PM
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.
Tags
TextBox
Asked by
Blas
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Share this question
or