Key Press Event
-
hi i wanna know how can i write codes in key press event of textbox because i can not see textbox in this menu(screenshot) http://aycu15.webshots.com/image/22014/2003314000409542092_rs.jpg[^]
:cool:hi, Do one thing........... In properties window of textbox select events tab (shown like lighting)... there is keypress event.............just doble click on it..........it will goes to code the function...........:cool: Nisar Inamdar............. Always for U..........
-
hi i wanna know how can i write codes in key press event of textbox because i can not see textbox in this menu(screenshot) http://aycu15.webshots.com/image/22014/2003314000409542092_rs.jpg[^]
There are two ways you can create the event handler routines for the key press event. Firstly in your initialisation routine type the following: (where "textBox1_KeyPress" will become the event handler routine) textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress); (As you are using Visual studio as soon as you type the "+=" part Visual Studio should prompt you with an auto complete option - press tab twice and it will create both the above line and the event handler routine) 2nd way is through the form designer. Click on the textbox and go to the textbox properties window. Click on the events button (the little lightning icon) then simply double click inside the KeyPress item in the list. This will create the routine for you and should take you to the code.
-
There are two ways you can create the event handler routines for the key press event. Firstly in your initialisation routine type the following: (where "textBox1_KeyPress" will become the event handler routine) textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress); (As you are using Visual studio as soon as you type the "+=" part Visual Studio should prompt you with an auto complete option - press tab twice and it will create both the above line and the event handler routine) 2nd way is through the form designer. Click on the textbox and go to the textbox properties window. Click on the events button (the little lightning icon) then simply double click inside the KeyPress item in the list. This will create the routine for you and should take you to the code.