PC Review


Reply
Thread Tools Rate Thread

How to add keyboard event to a menuitem?

 
 
Michael
Guest
Posts: n/a
 
      14th Apr 2007
Hi,
There is a menuitem in my windows application called Fill Data.
If user click this menu, one of the textbox will be filled in some
value.
Now I hope it work like this,
When user clicks this menu, at the same time, he presses Ctrl key, all
the textboxes will be filled in with some values.
How can I do that? Seems there is no keypress event for a menuitem?
Thanks!

 
Reply With Quote
 
 
 
 
Jan Hyde (VB MVP)
Guest
Posts: n/a
 
      16th Apr 2007
"Michael" <(E-Mail Removed)>'s wild thoughts were
released on 13 Apr 2007 19:27:53 -0700 bearing the following
fruit:

>Hi,
>There is a menuitem in my windows application called Fill Data.
>If user click this menu, one of the textbox will be filled in some
>value.
>Now I hope it work like this,
>When user clicks this menu, at the same time, he presses Ctrl key, all
>the textboxes will be filled in with some values.
>How can I do that? Seems there is no keypress event for a menuitem?
>Thanks!


No but you can test the keyboard state when the item is
clicked. Something like this for example

If Control.ModifierKeys = Keys.Control Then
Me.Text = "CONTROL+CLICK"
Else
Me.Text = "CLICK"
End If


 
Reply With Quote
 
Michael
Guest
Posts: n/a
 
      16th Apr 2007
On Apr 16, 10:52 am, "Jan Hyde (VB MVP)"
<StellaDrin...@REMOVE.ME.uboot.com> wrote:
> "Michael" <michae...@gmail.com>'s wild thoughts were
> released on 13 Apr 2007 19:27:53 -0700 bearing the following
> fruit:
>
> >Hi,
> >There is a menuitem in my windows application called Fill Data.
> >If user click this menu, one of the textbox will be filled in some
> >value.
> >Now I hope it work like this,
> >When user clicks this menu, at the same time, he presses Ctrl key, all
> >the textboxes will be filled in with some values.
> >How can I do that? Seems there is no keypress event for a menuitem?
> >Thanks!

>
> No but you can test the keyboard state when the item is
> clicked. Something like this for example
>
> If Control.ModifierKeys = Keys.Control Then
> Me.Text = "CONTROL+CLICK"
> Else
> Me.Text = "CLICK"
> End If


Cool!!
It works!
Thank you very much!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MenuItem and click Event!!! ucasesoftware@hotmail.fr Microsoft C# .NET 6 9th Sep 2005 04:44 PM
MenuItem and KeyDown Event =?Utf-8?B?VXJp?= Microsoft Dot NET Framework Forms 0 12th Feb 2005 07:09 PM
MDI MenuItem Popup event - can't use MenuItems.Add Dan H Microsoft Dot NET 0 21st Dec 2004 03:19 AM
MenuItem popup event xen0x Microsoft Dot NET Framework 1 17th Oct 2004 08:15 AM
MenuItem - Catching mouse down event? Derrick Microsoft C# .NET 0 4th Jun 2004 02:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:53 PM.