Solved

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

Posted on 2011-03-02
8
677 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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 

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

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 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