Hotkeys not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anuragshrivastava64
    New Member
    • Jan 2007
    • 66

    Hotkeys not working

    I have a command button user control whose caption is &Clear.
    Is it possible to create a hotkey for this button using Alt-C
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You just press Alt + C the code written for the button will execute.

    Comment

    • gobblegob
      New Member
      • Dec 2007
      • 133

      #3
      Originally posted by anuragshrivasta va64
      I have a command button user control whose caption is &Clear.
      Is it possible to create a hotkey for this button using Alt-C
      &Clear as caption is Alt-C hotkey, so if its not working then you might want
      to check the code under that command button to see if thats where you problem is.

      GobbleGob.

      Comment

      • anuragshrivastava64
        New Member
        • Jan 2007
        • 66

        #4
        Originally posted by debasisdas
        You just press Alt + C the code written for the button will execute.
        No actually I have made a user control whose caption is '&Clear' to make it look alike normal VB Command Button.

        The user control works same as command button except for the shortcut key.
        For the user control I have used a picture clip and a lable

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Try to handle the KeyDown event of the form and call the code there.

          Comment

          • pureenhanoi
            New Member
            • Mar 2007
            • 175

            #6
            Originally posted by anuragshrivasta va64
            No actually I have made a user control whose caption is '&Clear' to make it look alike normal VB Command Button.

            The user control works same as command button except for the shortcut key.
            For the user control I have used a picture clip and a lable
            You made an user control, and it must have the AccessKey. Does this correct?

            To set access key for yor control, you must use:
            UserControl.Acc essKey = "C" 'or any alphabet you want

            You can determine which should be the accesskey by analyze the "Caption" property of this control. The accesskey must be the Character following the Ampersand symbol.

            The event will be fired when the accesskey press must be definition in
            Private Sub UserControl_Acc esskeyPressed(k eyAscii As Interger)
            'example
            Call UserControl_Cli ck
            End Sub

            Private Sub UserControl_Cli ck()
            'do smthing else
            RaiseEvent Click
            End Sub

            Comment

            Working...