tags:

views:

41

answers:

1

i have a webmethod in my webservice

public class Service : System.Web.Services.WebService
{

    [WebMethod]
    public int ADD(int a,int b )
    {
        return a+b;
    }

}

i need to implement it in a windowapplication which contain a textbox .i added webreference there with foldername "localhost" and URL as "http://localhost:4484/WebSite2/Service.asmx"

using WindowsApplication4.localhost;

   localhost.Service s = new Service();
    s.ADD(12,34);
    textBox1.Text = s.ToString();

but i am getting result as "WindowsApplication4.localhost.Service" instead of "46" Can any one tell me the reason for this

+2  A: 

Shouldn't

s.ADD(12,34);
textBox1.Text = s.ToString();

be

textbox1.Text = s.ADD(12, 34).ToString(); ?

kristian
Thanks this works fine
peter