Solved

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

Posted on 2011-03-02
8
671 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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 article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

735 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