KeyEventArgs e

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Claudia Fong

    #1

    KeyEventArgs e


    I have the code below:

    private void OnKeyDownHandle r(object sender, KeyEventArgs e)
    {
    if (e.Key == Key.Return)
    {
    TextBox2.Text = "You Entered: " + textBox1.Text;
    }
    }

    but when I build the website it gaves me an error of

    The type or namespace name 'KeyEventArgs' could not be found (are you
    missing a using directive or an assembly reference?)

    Does someone know what I'm missing?

    Cheers!

    Claudi

    *** Sent via Developersdex http://www.developersdex.com ***
  • Tom Porterfield

    #2
    Re: KeyEventArgs e

    Claudia Fong wrote:
    I have the code below:
    >
    private void OnKeyDownHandle r(object sender, KeyEventArgs e)
    {
    if (e.Key == Key.Return)
    {
    TextBox2.Text = "You Entered: " + textBox1.Text;
    }
    }
    >
    but when I build the website it gaves me an error of
    >
    The type or namespace name 'KeyEventArgs' could not be found (are you
    missing a using directive or an assembly reference?)
    >
    Does someone know what I'm missing?
    KeyEventArgs is in the System.Windows. Forms namespace (or
    System.Windows. Input depending on what you are using for presentation)
    but neither of those are included by default in a webpage.

    Additionally, this appears to be server side code which would
    potentially mean a postback on each keydown event. That would be a poor
    experience for the user.

    The web TextBox control only supports the TextChanged event server-side,
    no key press type events.
    --
    Tom Porterfield

    Comment

    Working...