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

SpinEditor sound when Enter key is hit

3 Answers 164 Views
SpinEditor
This is a migrated thread and some comments may be shown as answers.
Mircea
Top achievements
Rank 1
Mircea asked on 11 Dec 2010, 05:09 PM
Hello,

I attempted to use RadSpinEditor to edit an integer value. Everything was fine with one exception: when Enter key is hit by the user (at the end, to announce the completion of the editing process), an annoying sound (beep) is heared. There is a way to get rid of this sound?

Mircea

3 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 11 Dec 2010, 07:04 PM
Hello,

The sound you are hearing is the standard windows ding. I think this may be caused by the textboxitem at some stage having a value that is out of range or similar. You can fix this with the following workaround.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AddHandler Me.RadSpinEditor1.SpinElement.TextBoxItem.KeyDown, AddressOf RadSpinEditor1_KeyDown
End Sub

Private Sub RadSpinEditor1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
    If e.KeyCode = Keys.Enter Then
        e.SuppressKeyPress = True
        If (CDec(Me.RadSpinEditor1.SpinElement.TextBoxItem.Text) > Me.RadSpinEditor1.Maximum) Then
            Me.RadSpinEditor1.Value = Me.RadSpinEditor1.Maximum
        ElseIf (CDec(Me.RadSpinEditor1.SpinElement.TextBoxItem.Text) < Me.RadSpinEditor1.Minimum) Then
            Me.RadSpinEditor1.Value = Me.RadSpinEditor1.Minimum
        Else
            Me.RadSpinEditor1.Value = CDec(Me.RadSpinEditor1.SpinElement.TextBoxItem.Text)
        End If
    End If
End Sub

Hope this helps, but let me know if you have any questions
Richard
0
Mircea
Top achievements
Rank 1
answered on 12 Dec 2010, 09:34 AM
Hello Richard,

Now it works. I have missed e.SuppressKeyPress = True. Maybe Telerik will include the possibility to remove the sound as a built-in feature in a future release.

Many thanks,

Mircea
0
Richard Slade
Top achievements
Rank 2
answered on 12 Dec 2010, 10:56 AM
Glad that helped. Please remember to mark as answer so others can find the solution too.

All the best
Richard
Tags
SpinEditor
Asked by
Mircea
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Mircea
Top achievements
Rank 1
Share this question
or