473,790 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What does setting e.Handled = True in KeyUp do?

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?

In the Control I also continue to get KeyPress and KeyUp events.

In them I also have the same code to set e.Handled = True

Thanks

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows. Forms.KeyEventA rgs)

If mReadOnly Then

e.Handled = True

Else

snip...

End If

MyBase.OnKeyUp( e)

End Sub

Nov 21 '05 #1
4 6980
you are calling mybase.onkeyup, which will always raise the event. you are
not handling the event, you are simply overriding it.
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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?

In the Control I also continue to get KeyPress and KeyUp events.

In them I also have the same code to set e.Handled = True

Thanks

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows. Forms.KeyEventA rgs)

If mReadOnly Then

e.Handled = True

Else

snip...

End If

MyBase.OnKeyUp( e)

End Sub

Nov 21 '05 #2
What does setting e.Handled = True do?

Thanks

"Rick Mogstad" <Ri**********@G Mail.NOSPAM.com > wrote in message
news:u3******** ******@tk2msftn gp13.phx.gbl...
you are calling mybase.onkeyup, which will always raise the event. you
are not handling the event, you are simply overriding it.
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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?

In the Control I also continue to get KeyPress and KeyUp events.

In them I also have the same code to set e.Handled = True

Thanks

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows. Forms.KeyEventA rgs)

If mReadOnly Then

e.Handled = True

Else

snip...

End If

MyBase.OnKeyUp( e)

End Sub


Nov 21 '05 #3
when the event is raised, it will check cause subsequent handlers to not be
called. It needs to be set inside of an event handler though, and you are
not.
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:un******** ******@TK2MSFTN GP12.phx.gbl...
What does setting e.Handled = True do?

Thanks

"Rick Mogstad" <Ri**********@G Mail.NOSPAM.com > wrote in message
news:u3******** ******@tk2msftn gp13.phx.gbl...
you are calling mybase.onkeyup, which will always raise the event. you
are not handling the event, you are simply overriding it.
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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?

In the Control I also continue to get KeyPress and KeyUp events.

In them I also have the same code to set e.Handled = True

Thanks

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows. Forms.KeyEventA rgs)

If mReadOnly Then

e.Handled = True

Else

snip...

End If

MyBase.OnKeyUp( e)

End Sub



Nov 21 '05 #4

"Rick Mogstad" <Ri**********@G Mail.NOSPAM.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
when the event is raised, it will check cause subsequent handlers to not
be called. It needs to be set inside of an event handler though, and you
are not.
Thanks



" **Developer**" <RE************ *@a-znet.com> wrote in message
news:un******** ******@TK2MSFTN GP12.phx.gbl...
What does setting e.Handled = True do?

Thanks

"Rick Mogstad" <Ri**********@G Mail.NOSPAM.com > wrote in message
news:u3******** ******@tk2msftn gp13.phx.gbl...
you are calling mybase.onkeyup, which will always raise the event. you
are not handling the event, you are simply overriding it.
" **Developer**" <RE************ *@a-znet.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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?

In the Control I also continue to get KeyPress and KeyUp events.

In them I also have the same code to set e.Handled = True

Thanks

Protected Overrides Sub OnKeyUp(ByVal e As
System.Windows. Forms.KeyEventA rgs)

If mReadOnly Then

e.Handled = True

Else

snip...

End If

MyBase.OnKeyUp( e)

End Sub




Nov 21 '05 #5

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

Similar topics

1
1900
by: Jason | last post by:
I have created a c-sharp app that has keyup, keydown events tied to the form. The form also has some other controls, buttons, labels and 1 custom control that I made which inherits from user control. My problem is ... When I first start the app all my keyboard events work fine and by doing debugging I can see that my form has the focus. After I click on a button or my custom control the focus is shifted to those controls and the keyup,...
2
2721
by: Amos Soma | last post by:
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
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) {
1
3569
by: Keith Smith | last post by:
If a KeyUp event takes place on my form, how can I keep the KeyDown/KeyPress/KeyUp events from being run on the control event itself. I tried putting e.Handled=true; at the end of my KeyUp event, but that doesn't seem to work. Am I missing something? It appears that the KeyUp event on my control still runs. Help!
9
2460
by: Jay | last post by:
Everywhere I go (read/browse) I see these parameters.... ByVal sender As Object, ByVal e As System.EventArgs Yet I never see them used within the function/method. Could someone tell me what they mean/do please. JP
2
3067
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?
1
2100
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this works. The first set of code I downloaded from internet and when i tried it, it worked fine. But when I changed the second part of the code it started to give me trouble. Before I changed the code they used Datacolumns,Datarows and Datatables and...
3
1532
by: Jason Huang | last post by:
Hi, In my .Net 1.1 C# windows form, I have a DataGrid DG1. The DG1 have a column dc1 which format is TextBox. And I want to check the whave value I have typed in. My question is the new value doesn't really go into the DataGrid1's dc1 until some event occurs (e.g., KeyPress, KeyDown, ...) but I don't know what the event is. Is it possible to observe what event I'm in? Thanks for help.
11
7655
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I know I sound like a one-note Johnny on this but I'm still looking for a solution. I need to display characters coming in from a serial port or a socket. I also need to be able to type characters into the display myself - but that's not the main issue at this time. I've tried a scrolling multiline text box but once the original viewable area fills up and it starts scrolling the flashing of the entire area drives me nuts. The...
0
9666
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
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10201
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...
0
9987
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9023
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...
0
6770
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
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2910
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.