TextBox Keydown

D

DaveHenson

Hi,
Everytime I double the textbox in design screen, it will direct me to
the TextChanged method. I need to add the code myself in the .cs file
(like below 1) and .Designer.cs file (like below 2) for other like
Keydown.

1:
private void txtInvoice_KeyDown(object sender, KeyEventArgs e)
{ }

2:
this.txtCartonID.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.txtCartonID_KeyDown);

Is there any other way to add the code?
 
S

Sergey Poberezovskiy

You can select your textbox in the designer, then press F4 to open properties
window. In the properties window you can click on the Events button - with
lightning symbol - and then select the event you're after - KeyDown. When you
double click on the dropdown next to the event name, VS will create all the
required code for you - both in the designer and the code behind

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top