Solved

VB.Net Currency Conversion (E.g. NZD to AUD)

Posted on 2011-03-02
8
663 Views
Last Modified: 2012-05-11
Hey,

I'm looking to add a currency converter into my vs 2010 application. How would I go about doing this? Reading HTML from a website?

Ideas please.

Thanks!
Jessee
0
Comment
Question by:Letsgetcoding
  • 4
  • 3
8 Comments
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35015950
Hi,

If you want to build a new one by yourself then you need to have current/updated Exchange Rates of all the countries you want to support currency conversion.

Please provide details on what exactly you want to build.

Asim
0
 

Author Comment

by:Letsgetcoding
ID: 35016063
It is only going to need to have around about 4 different currencies.

All I am needing is ideas on how to get this information, I can build the rest of it myself.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 35016102
You can use existing webservices to perform this

Currency Conversion Using WebServices
http://www.dotnetspider.com/resources/28835-Currency-Conversion-Using-WebServices.aspx
0
 

Author Comment

by:Letsgetcoding
ID: 35016329
Ok, had a look at that site and followed it to the link http://www.webservicex.net/CurrencyConvertor.asmx?WSDL

The server just keeps returning to busy when I try to add a web service reference.

Know of any other sites?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35016442
In order to build your own, you can use the exchange rate information from the following:
http://www.oanda.com/currency-data/?srccont=belowgraphic
You can process xml from above and build your converter.

I hope it helps.
Asim
0
 

Author Comment

by:Letsgetcoding
ID: 35016609
Ok attached is the code and it seemingly works fine.

Problem is, when I change text in the dropdownlistfromcountry, it the dropdownlisttocountry also changes, and vice versa.

Any ideas why this is?
Private Sub frmEditProduct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Get the list Country Supported using Currency from WebService
        'Create a Reference to the WebService
        Dim Currency As CurrencyConverter.Currency
        'Array for Getting the Country List From WebService
        Dim CountryList As System.Array
        'Get the List of Countries
        CountryList = [Enum].GetValues(Currency.GetType)
        'Bind to the DropDownLists
        DropDownListFromCountry.DataSource = CountryList
        'DropDownListToCountry.DataBind()
        dropdownlisttocountry.DataSource = CountryList
        'DropDownListToCountry.DataBind()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'Create an Instance to the WebService
        Dim CurrencyConvertor As New CurrencyConverter.CurrencyConvertor
        'Curency Conversion Enum
        Dim Currency As New CurrencyConverter.Currency
        'Get the Currency Rate
        Dim dt As Double = CurrencyConvertor.ConversionRate(System.Enum.Parse(Currency.GetType(), dropdownlistfromcountry.Text), System.Enum.Parse(Currency.GetType(), dropdownlisttocountry.Text))
        MsgBox(String.Format("Converted Amount {0}", dt * Convert.ToDouble(TextBoxRes.Text.Trim)))
    End Sub

Open in new window

0
 
LVL 10

Accepted Solution

by:
Asim Nazir earned 500 total points
ID: 35016624
Since both drop downs are bound to same datasource i.e. CountryList, this is why they both get changed :)
Create a copy of CountryList and bind that copy to one of the drop down. THis will fix this issue.

Asim
0
 

Author Closing Comment

by:Letsgetcoding
ID: 35016669
Works Brilliant! Thanks guys
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now