SpinEditor sound when Enter key is hit

4 posts, 1 answers
  1. Mircea
    Mircea avatar
    3 posts
    Member since:
    Nov 2010

    Posted 11 Dec 2010 Link to this post

    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
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 11 Dec 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mircea
    Mircea avatar
    3 posts
    Member since:
    Nov 2010

    Posted 12 Dec 2010 Link to this post

    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
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Dec 2010 Link to this post

    Glad that helped. Please remember to mark as answer so others can find the solution too.

    All the best
    Richard
Back to Top