Key Down Event in Text Box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • orekinbck@yahoo.com.au

    #1

    Key Down Event in Text Box

    Hi

    How do I catch a SHIFT TAB in the key down event of a text box?

    Thanks
    Bill

  • Morten Wennevik

    #2
    Re: Key Down Event in Text Box

    Hi Bill,

    The TextBox KeyDown event won't receive a TAB unless you set the TextBox.Multili ne = true as well as TextBox.Accepts Tab = true. If this is unwanted you can however override PreProcessMessa ge in an inherited TextBoz

    class MyTextBox : TextBox
    {
    public override bool PreProcessMessa ge(ref Message msg)
    {
    if((int)msg.WPa ram == 9 && Control.Modifie rKeys == Keys.Shift)
    MessageBox.Show ("SHIFT-TAB");
    return base.PreProcess Message (ref msg);
    }
    }


    --
    Happy coding!
    Morten Wennevik [C# MVP]

    Comment

    • orekinbck@yahoo.com.au

      #3
      Re: Key Down Event in Text Box

      Thanks for that!
      Bill

      Comment

      • orekinbck@yahoo.com.au

        #4
        Re: Key Down Event in Text Box

        Thanks Morten
        Regards
        Bill

        Comment

        Working...