Results 1 to 3 of 3

Thread: ShortCut Key for Image Button - URGENT

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    2

    Question ShortCut Key for Image Button - URGENT

    Hi,

    I have a button with an image to perform a specific operation.

    I want to use Alt-D as a shortcut key to simulate its click using the shortcut.

    Any ideas would be appreciated much..

    TIA,
    Mohan

  2. #2
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    halu,

    i'm kinda new. but this might help. use the button key down. try this.
    Code:
        Private Sub Button1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Button1.KeyDown
            If e.Control AndAlso e.KeyCode = Keys.D Then
                MsgBox("blah blah...")
            End If
        End Sub
    but remeber, this only performs if focused...

    --ayan

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    If you set the KeyPreview property of your form to True then you can use Ayan's suggestion in the KeyDown event of the form. This way it would fire as long as the form has focus, not just the button.
    This world is not my home. I'm just passing through.

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