Reputation: 753
I have used this method on form2 to get values over to form3:
**form2.cs**
Form3 frm3 = new Form3(cbDelivery.Text, cbOderNo.Text, cbCartonCode.Text, lblGRV.Text);
frm3.Show();
this.Hide();
But now every time I want to use that I get "no overload for method 'form3' takes '0' arguments".
I do understand its looking for that same values but I don't need them. For example when I'm on form4 and want to go back to form3.
How do I bypass this?
Thanks in advance.
Upvotes: 0
Views: 1403
Reputation: 17680
You could set default values for the constructor parameters when you define the class.
or define an overloaded constructor that takes no parameters.
public class form3
{
public form3(string cbDelivery="", string cbOrderNo = "",
string cbCartonCode = "", string lblGRV = "")
{
}
}
Upvotes: 0
Reputation: 6335
Somewhere in your code there is a call to a method named form3 (in your code example it is a constructor but the error says otherwise) with zero arguments. Overloading is a feature lets you to create multiple methods with same name but different number of arguments. So compiler is looking for a match and tells you that there is no overload of this method that takes 0 arguments. You should fix your method calls.
Upvotes: 1
Reputation: 1245
If I understood your query correctly, I think this may help you
passing data between 3 windows forms in visual studio using C#
Upvotes: 0