Answered by:
No overload for method takes 2 arguments_

Question
-
this is my code i want my web application's form when i click a button it calls a method from my web service but i am getting this error " No overload for method 'HelloWorld' takes 2 arguments " what can i do
protected void Button1_Click(object sender, EventArgs e)
{
localhost.Service1 mys= new localhost.Service1();
string nam = TextBox1.Text;
string pas = TextBox2.Text;
TextBox3.Text = mys.HelloWorld(nam, pas);
}
Answers
-
The error message means that the HellpWorld method that you created does not take two parameters. It may have one, or three, and therefore it doesn't match the signature of your invocation.
Note that you are not calling the actual method in your webservice. You are calling the method in the proxy that was automatically generated when you added the web reference. This means that even if you modify the web service so that the method does take two parameters, you will still receive the error until you refresh the proxy so that it matches the real method in the service (in Visual Studio right-click on the web reference and select the option to update it).
- Proposed as answer by Ante Meridian Friday, August 8, 2014 11:41 PM
- Marked as answer by Kristin Xie Monday, August 18, 2014 1:43 AM
All replies
-
The error message means that the HellpWorld method that you created does not take two parameters. It may have one, or three, and therefore it doesn't match the signature of your invocation.
Note that you are not calling the actual method in your webservice. You are calling the method in the proxy that was automatically generated when you added the web reference. This means that even if you modify the web service so that the method does take two parameters, you will still receive the error until you refresh the proxy so that it matches the real method in the service (in Visual Studio right-click on the web reference and select the option to update it).
- Proposed as answer by Ante Meridian Friday, August 8, 2014 11:41 PM
- Marked as answer by Kristin Xie Monday, August 18, 2014 1:43 AM
-