Home All Groups Group Topic Archive Search About

how to create shift-F2 function for Textbox - shortcutkey?

Author
30 Jun 2006 5:43 PM
Rich
Hello,

I need to add a shift-F2  function to textboxes to bring up a dialogform
with the expanded text contained in the respective Textbox.  On any of the
keydown events of a textbox I can only trap for one key - well, I only know
how to trap for one key.  How can I trap for Shift-F2 combination?  I see
that menuItems have shortcutkey options.  How can I create similar
functionality for the textbox control?

Thanks,
Rich

Author
30 Jun 2006 6:30 PM
Ahmed
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.Shift And e.KeyCode = Keys.F2 Then
            MsgBox("")
        End If


    End Sub


Rich wrote:
Show quoteHide quote
> Hello,
>
> I need to add a shift-F2  function to textboxes to bring up a dialogform
> with the expanded text contained in the respective Textbox.  On any of the
> keydown events of a textbox I can only trap for one key - well, I only know
> how to trap for one key.  How can I trap for Shift-F2 combination?  I see
> that menuItems have shortcutkey options.  How can I create similar
> functionality for the textbox control?
>
> Thanks,
> Rich
Author
30 Jun 2006 6:41 PM
Rich
Many thanks.  That was just what I was looking for.

Rich

Show quoteHide quote
"Ahmed" wrote:

>     Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
> System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
>         If e.Shift And e.KeyCode = Keys.F2 Then
>             MsgBox("")
>         End If
>
>
>     End Sub
>
>
> Rich wrote:
> > Hello,
> >
> > I need to add a shift-F2  function to textboxes to bring up a dialogform
> > with the expanded text contained in the respective Textbox.  On any of the
> > keydown events of a textbox I can only trap for one key - well, I only know
> > how to trap for one key.  How can I trap for Shift-F2 combination?  I see
> > that menuItems have shortcutkey options.  How can I create similar
> > functionality for the textbox control?
> >
> > Thanks,
> > Rich
>
>
Author
1 Jul 2006 7:08 PM
Jay B. Harlow [MVP - Outlook]
Rich,
In addition to the KeyDown event, I would consider using the ProcessCmdKey
instead.

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B320583

As it allows you to capture keys that may not show up in the KeyDown
event...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"Rich" <R***@discussions.microsoft.com> wrote in message
news:84891FAC-0F74-4BB3-99B9-44E5A46FB0B7@microsoft.com...
| Hello,
|
| I need to add a shift-F2  function to textboxes to bring up a dialogform
| with the expanded text contained in the respective Textbox.  On any of the
| keydown events of a textbox I can only trap for one key - well, I only
know
| how to trap for one key.  How can I trap for Shift-F2 combination?  I see
| that menuItems have shortcutkey options.  How can I create similar
| functionality for the textbox control?
|
| Thanks,
| Rich
|
|