: 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?