U want to add the method textBox1_KeyPress to KeyPress eventhandler of other textboxes as well.
U can do this
1. using the GUI builder in Visual Studio:
Select all the appropriate textboxes in the GUI builder (by holding down the control key). Then in the properties window, click on the small lightning icon. Navigate down to keyPress event and click the down arrow in front of it. There u will find this method named textBox1_KeyPress. Click on it.
2. using code:
write this somewhere in your
Form1_Load(object sender, EventArgs e)
and so on...
Actually if You use method 1, the code in method 2 automatically gets written in InitializeComponent() method in Form1.Designer.cs file.
*Replace "Form1" by name of the form in question.