473,396 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

e.Handled and F10

In my Win form, I have KeyPreview set to True. In my form KeyUp method, I
have the following code:

if (e.KeyCode == Keys.F10)
{
e.Handled = true;
MessageBox.Show( "F10 pressed" );
}

The message is displayed correctly. However, focus moves off my form and
unto my menu, even though I have e.Handled set to true. How can I prevent
this from happening?

Thanks.
Nov 16 '05 #1
2 2697
"Amos Soma" <amos_j_soma@y_a_hoo.com> wrote:
In my Win form, I have KeyPreview set to True.
In my form KeyUp method, I have the following
code:
[...]
The message is displayed correctly. However, focus
moves off my form and unto my menu, even though
I have e.Handled set to true.


What operating system are you using? I can't reproduce this on Windows
XP Professional. Whether KeyPreview is true or false, F10 only goes to
the menu if I do *not* set e.Handled = true.

Anyway, my first suggestion is not to use F10, because it's a standard
Windows shortcut for going to the menu bar. It's a bit like assigning
your own special meaning to the Start key - it will no longer perform
its proper function.

Otherwise, I suppose you'll have to do something messy like
temporarily disabling the menus in your KeyUp handler and re-enabling
them afterwards.

P.
Nov 16 '05 #2
what means "e.handled" in visual studio net 2005 and when could be true or false. sorry but im from other country and i think this could be a stupid question, but what could i do ?
Please helpme!!!!!
Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Fred Gravel | last post by:
I have a Windows app that I have installed on 3 client machines (all win2k) thatreturn an un-handled error message when starting up. I have placed 'Try/Catch/Finally' blocks in the 'sub main' and...
5
by: Uchiha Jax | last post by:
I have created a custom textbox which contains an arraylist of permitted chars. Any chars that are not in the list are not permitted. One of the events looks like this and is attached to either...
4
by: Tom | last post by:
I have a ComboBox that I wrote a KeyPress event for. Basically, it looks to make sure that a numeric key has been pressed; if not, then it does a Beep() and sets e.Handled to True. This should, as...
5
by: Lucvdv | last post by:
Can someone explain why this code pops up a messagebox saying the ThreadAbortException wasn't handled? The first exception is reported only in the debug pane, as expected. The second (caused by...
2
by: Murthy | last post by:
Hi, After genarating the exe when i run the exe the following error is comming. Common Language Runtime Debugging Services Application has generated an exception that could not be handled....
2
by: **Developer** | last post by:
I have a usercontrol that contains the following. To my surprise the form containing this control get KeyUp events. Help says that for KeyPress setting e.Handled = True suppresses KeyPress...
4
by: **Developer** | last post by:
I have a usercontrol that contains the following. To my surprise the form containing this control get KeyUp events. Help says that for KeyPress setting e.Handled = True suppresses KeyPress...
2
by: Alex | last post by:
Hello, All. I encouraged some strange behaviour of either IIS, ASP.NET, IE or donn't know what... I have a simple wait.aspx page private void Page_Load(object sender, System.EventArgs e) {...
6
by: mj2736 | last post by:
I created a windows form control that inherits from the standard .Net DataGridView control, to which I've added custom functionality. Instead of using the standard control in my applications, I use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.