473,398 Members | 2,404 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,398 software developers and data experts.

Re: Event Handlers

On Aug 5, 12:35*am, Steve Behman
<SteveBeh...@discussions.microsoft.comwrote:
Pavel, I am very sorry about my previous post -- the problem actually
occurred in *nearby code . * That is the answer to question 1, however it
leads me to a fourth question;
How can I get the system to complete the "normal" *processing of the *
(possibly modified) keystroke?
For KeyDown, you can allow it to process the event normally by setting
Handled and SuppressKeyPress properties of KeyEventArgs to false (or
not touching those properties in the first place, since their default
value is false). You cannot rewrite keycodes in KeyDown event handler,
though.

In KeyPress event handler, you can modify input characters simply by
changing the value of KeyPressEventArgs.KeyChar property. Again,
unless you set Handled to true, the default processing will take place
after your event handler returns, and the modified character value
will be used (e.g. inserted into the text in case of TextBox).

Aug 5 '08 #1
1 910
Pavel,

Using the keypressed event worked like a charm! I can now manage a regular
TextBox as I might have used a masked text box and as a bonus not have to put
up with the ugly placeholders. I just "swallow" the unwanted characters.

Thank you so very much for the help.

"Pavel Minaev" wrote:
On Aug 5, 12:35 am, Steve Behman
<SteveBeh...@discussions.microsoft.comwrote:
Pavel, I am very sorry about my previous post -- the problem actually
occurred in nearby code . That is the answer to question 1, however it
leads me to a fourth question;
How can I get the system to complete the "normal" processing of the
(possibly modified) keystroke?

For KeyDown, you can allow it to process the event normally by setting
Handled and SuppressKeyPress properties of KeyEventArgs to false (or
not touching those properties in the first place, since their default
value is false). You cannot rewrite keycodes in KeyDown event handler,
though.

In KeyPress event handler, you can modify input characters simply by
changing the value of KeyPressEventArgs.KeyChar property. Again,
unless you set Handled to true, the default processing will take place
after your event handler returns, and the modified character value
will be used (e.g. inserted into the text in case of TextBox).

Aug 11 '08 #2

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
6
by: Charles Law | last post by:
I have a class, which implements an interface. Let's say, that the interface looks something like Public Interface IEventSinks Sub ValueChanged(sender As Object, e As ValueChangedEventArgs) Sub...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
5
by: Amit | last post by:
Hello! Is it possible to find how many event handlers an event has at runtime? How about finding whether or not an event has event handlers? In C# you can compare the event with null to check if...
7
by: Michael D. Ober | last post by:
Is there anyway to raise an event from a class and require that any program using that class (not just inheritance) have an event handler for specific events in the class? In my case, some events...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
6
by: Jake K | last post by:
Where is the best place to define event handlers? I need to define event handlers for a COM object referenced in my project and am doing so in the fowm load. Is this the best place?
5
by: Lloyd Sheen | last post by:
Is there a way to get the event handlers such that I can cache the info about handlers for a particular control, remove the handlers, do some code and restore the cached event handlers in VB.NET...
6
by: Tony Johansson | last post by:
Hello! I know it's possible to have several event handler for a single event but I can't see any point using several event handler for this. I'm probably wrong so can anybody tell me what...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
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.