I have a method as shown below. It passes a form as a parameter, Form1 form
. This is because I am calling the method from a form called Form1 using the call edit.DropHire(this)
;
The contents of the method are exactly the same as what I want to use for several other forms, but I want to avoid code repetition. Is there a way I can change the parameter of the method based on what form I am on when I call the method. I.e change it to DropHire(Form2 form)
for Form 2, DropHire(Form3 form)
for Form 3, DropHire(Form4 form)
for Form 4.
Current Method:
public void DropHire(Form1 form)
{
form.textbox1.Text = "123";
}
Example of what I want to change it to if I call it from another form:
public void DropHire(Form2 form)
{
form.textbox1.Text = "123";
}