CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010

    Web Services C# Windows Forms

    I am trying to use a web service to populate a label from two Currencies .
    I right click and added the web reference to the project.

    Here is the link the the service...


    Here is the Link the the WSDL...


    I know that this service support the following method:


    i try this but im sure this is not right..

    ServiceReference1.ConversionRateRequest CMyClass = new WebService.ServiceReference1.ConversionRateRequest("USD", "PHP");

    What do i need to do?

  2. #2
    Join Date
    Sep 2000

    Re: Web Services C# Windows Forms

    I didn't try as as WCF service but as a Web Service. When you add the service reference, go to the advanced tab and add as a web service. Then I used the following code in a windows form (where "CurrenctConverter" was the name of the service I added).

            private void button1_Click(object sender, EventArgs e)
                CurrencyConverter.CurrencyConvertor aa = new Test.CurrencyConverter.CurrencyConvertor();
                CurrencyConverter.Currency USA = CurrencyConverter.Currency.USD;
                CurrencyConverter.Currency BPS = CurrencyConverter.Currency.GBP;
                double ExchangeRate =  aa.ConversionRate(USA, BPS);

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Web Services C# Windows Forms

    In VS 2008, you need to add a "Web reference" instead of a "Service reference".

    Right click on the References node in solution explorer and choose "Add Web reference". If you don't see this item, then choose "Add Service Reference". Once the service ref form opens, click on the "Advanced" button and choose "Add Web reference" near the bottom of the form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)