Results 1 to 8 of 8

Thread: VB 2013 Shortcut Keys cases beeping

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2015
    Posts
    17

    VB 2013 Shortcut Keys cases beeping

    I have create a shortcut to click a button and the shortcut works but each time i click the shortcut the computer beeps.

    The short cut i use is Shift + Control + T

    Is there a way to stop the beeping?


    Thanks.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,461

    Re: VB 2013 Shortcut Keys cases beeping

    Clicking is done with the mouse so you must be pressing the shortcut, not clicking it. How exactly have you implemented it in code? Presumably that is where the issue is but we can only guess if we can't see the code.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2015
    Posts
    17

    Re: VB 2013 Shortcut Keys cases beeping

    This is the code -

    Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyCode = Keys.T AndAlso e.Modifiers = Keys.Control Then
    Button1.PerformClick()
    End If
    End Sub

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,461

    Re: VB 2013 Shortcut Keys cases beeping

    I tried your code and got no beep anyway but perhaps try setting e.Handled to True.

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,461

    Re: VB 2013 Shortcut Keys cases beeping

    By the way, that code is detecting Ctrl+T, not Ctrl+Shift+T. If you want Ctrl+Shift+T then use:
    Code:
    If e.KeyCode = Keys.T AndAlso e.Modifiers = (Keys.Control Or Keys.Shift) Then
    or, as I would do:
    Code:
    If e.KeyData = (Keys.Control Or Keys.Shift Or Keys.T) Then

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2015
    Posts
    17

    Re: VB 2013 Shortcut Keys cases beeping

    Hi jmcilhinney,

    Thanks for the info, i changed the keys since the post and left it as CTRL + T so the code is fine.

    I guess that the beeps are sound settings of my windows machine.

  7. #7
    Hyperactive Member jazFunk's Avatar
    Join Date
    Dec 2008
    Location
    Palm Harbor
    Posts
    407

    Re: VB 2013 Shortcut Keys cases beeping

    Add this code to stop the beeps:

    vb.net Code:
    1. e.SuppressKeyPress = True
    Things I've found useful:
    DateTime.ToString() Patterns | Retrieving and Saving Data in Databases | ADO.NET Data Containers: An Explanation

    Quote of the day from jmcilhinney:
    'Talking about Option Strict and Option Explicit in the same sentence is pointless unless it is to say that they should both be On.'

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Mar 2015
    Posts
    17

    Re: VB 2013 Shortcut Keys cases beeping

    Thanks jazFunk I will check it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width