Using Function Keys
-
Dear Abhijit, Which MDI's event i will use?I use KeyDown event and i wrote: if(e.KeyCode==Keys.F1) { frmAllCheckInformation objfrmAllCheckInformation=new frmAllCheckInformation(); objfrmAllCheckInformation.ShowDialog(); } Form is opened only one time.When i close and again press F1 the form is not coming. would u help me...
You need to use
ProcessKeyMessage
Check It[^]Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Try with this :
if (e.KeyCode == Keys.F1)
DoSomething();Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
Why?
Panic, Chaos, Destruction. My work here is done.
-
thank you very much for ur reply. i using this way but its not working.would u help me: if(e.KeyCode.ToString()"F1") { frmAllCheckInformation objfrmAllCheckInformation=new frmAllCheckInformation(); objfrmAllCheckInformation.ShowDialog(); }
Use google, or bing, and look for ShortcutKeys for crisake! In the designer, menu command, property ShortcutKeys set it. JOB DONE. Stop faffing about.
Panic, Chaos, Destruction. My work here is done.
-
You need to use
ProcessKeyMessage
Check It[^]Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Dear Coders, I building a windows application using C#.I build a MDI.MDI has menu.i need when i press like F1(function keys) a specific form will open.This way i want to use F1...F12.Which event and how i do that. Any suggestion is appreciated.Thanks in Advance. Shafik
-
You need to use
ProcessKeyMessage
Check It[^]Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
In the MDI form, create a menu item for each child form and assign keyboard shortcuts to the items.
-
Dear Abhijit, Which MDI's event i will use?I use KeyDown event and i wrote: if(e.KeyCode==Keys.F1) { frmAllCheckInformation objfrmAllCheckInformation=new frmAllCheckInformation(); objfrmAllCheckInformation.ShowDialog(); } Form is opened only one time.When i close and again press F1 the form is not coming. would u help me...
-
Why?
Panic, Chaos, Destruction. My work here is done.
Nagy Vilmos wrote:
Why?
I didn't get you.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
thanks abhijit i soled the problem.just done below: //KeyPreview property should be true if(e.KeyCode==Keys.F1) { frmAllCheckInformation objfrmAllCheckInformation=new frmAllCheckInformation(); objfrmAllCheckInformation.ShowDialog(); } Shafik
That's Great !:thumbsup:
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Nagy Vilmos wrote:
Why?
I didn't get you.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
The example is right, but the concept being encouraged is not. There should be commands that launch the forms in this case, and how it is called shouldn't be hard coded beyond the minimum. The command class allows for a short cut key to be associated and that should provide the nescessary access. Overriding the keybouard handler is really too low level for what is already provided by the framework.
Panic, Chaos, Destruction. My work here is done.
-
Hey, This has gone on long enough. What people are trying to tell you is to just assign a function key as a short cut key. These assignments are usually done through the designer but example code is
this.MyMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
. Alan. -
Please try out something on your own before posting so many questions. You can assign function keys as shortcut keys for menu items in the form designer. Select the menu item in the designer and look for the Shortcut property in the Property Explorer window.
-
The example is right, but the concept being encouraged is not. There should be commands that launch the forms in this case, and how it is called shouldn't be hard coded beyond the minimum. The command class allows for a short cut key to be associated and that should provide the nescessary access. Overriding the keybouard handler is really too low level for what is already provided by the framework.
Panic, Chaos, Destruction. My work here is done.
That's true. Thanks !
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.