Solved

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

Posted on 2011-03-02
8
661 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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