How to write event for keydown

how to write an keydown event in c#.net.
Please give me answer with code

Comments

  • : how to write an keydown event in c#.net.
    : Please give me answer with code
    :

    In InitializeComponent():
    //this hooks the keydown event to a textbox named 'textBox1'
    this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);

    //this is the code which will be executed on keydown
    private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
    {
    //your code here
    }

    You don`t use the Visual Studio, do you? Why you need to do this manually?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion