Re: Event Handlers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pavel Minaev

    Re: Event Handlers

    On Aug 5, 12:35 am, Steve Behman
    <SteveBeh...@di scussions.micro soft.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 SuppressKeyPres s 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 KeyPressEventAr gs.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).

  • =?Utf-8?B?U3RldmUgQmVobWFu?=

    #2
    Re: Event Handlers

    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...@di scussions.micro soft.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 SuppressKeyPres s 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 KeyPressEventAr gs.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).
    >
    >

    Comment

    Working...