473,804 Members | 3,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2721
"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
troyafull
1 New Member
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
287
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 it doesn't even get to there. Problem is the application works fine on my development PC. I have MDAC v2.8 and Framework 1.1 on all machines. I have cross checked all of the .dll versions and verified that they are the same as the ones on my...
5
17675
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 this.KeyUp or this.KeyDown: private void TextBoxEx_KeyAction(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.Enter) {
4
7563
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 I understand it, cause the character to 'go away' and not be displayed in the box. I have tried this on a plain old TextBox and it functions as it should. However, with a ComboBox the character stays in the box! The code (via the debugger)...
5
5756
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 thread.Abort()) is reported twice: once in the debug window, and once through the message box. Is it because the thread was sleeping when the exception occurred?
2
2154
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. Process id=0xdec (3564), Thread id=0xdf0 (3568) When I click CANCEL to debug, I get this error-message:
2
3068
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 events but say very little about KeyUp. What does setting to Handled do?
4
6981
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 events but say very little about KeyUp. What does setting to Handled do?
2
1362
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) { object o = new object();
6
6103
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 my customized version. I have an event handler in the custom control for the KeyDown event that simulates a double-click on the selected grid row when the user presses the enter key. This is working just fine. Now, some screens that are using...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.