I still have trouble to understand calling method from class.
Let's say, I have two textbox in Form1 and two textbox in Form2, and all those four textboxes use the same code.
So how can I put the code in class, so that I don't need to repeat the code? The thing I don't understand is: class does not have textbox, how can I write txtbox Key Press there?
Anyway, how to write it and what is the code to call it?
Thanks.
private void txtBoxFirstNameinForm1_KeyPress(object sender, EventArgs e)
{
//Validate input character
}
private void txtBoxFirstNameinForm2_KeyPress(object sender, EventArgs e)
{
//Validate input character
}
private void txtBoxLastNameinForm1_KeyPress(object sender, EventArgs e)
{
//Validate input character
}
private void txtBoxLastNameinForm2_KeyPress(object sender, EventArgs e)
{
//Validate input character
}
