Click here to Skip to main content
15,881,709 members
Articles / Programming Languages / C#
Article

Currency Convertor

Rate me:
Please Sign up or sign in to vote.
3.13/5 (19 votes)
30 May 2005GPL31 min read 84.4K   974   24   26
Converts one currency into another using Yahoo finance exchange rates.

Sample Image - CurrencyConvert.jpg

Introduction

This is a simple tool, that checks the yahoo website for the latest currency rates and converts the given currency into another. It downloads the required exchange rate only when needed and save it for further calculations. So, it saves round way trip again and again to the yahoo website. You can also clear all the downloaded exchange rates. It also shows the latest stock market report. It also automatically checks for any new version available at http://www.priyank.in/ for download, and reports user about the same.

How it works

Actually its internal working is very complex, we have to download the page from yahoo website using HttpWebRequest and HttpWebResponse and apply regular expression to the data, fetch the currency rates, using Regex class' Match function. See, how hard it is, download the page with URL like:

<A href="http://finance.yahoo.com/currency/convert?amt=1&from=USD&to=INR&submit=Convert">
http://finance.yahoo.com/currency/convert?amt=1&from=USD&to=INR&submit=Convert</A>

Replace USD and INR with your currency symbols used by yahoo website and apply a regular expression like:

</td><td\sclass=\"yfnc_tabledata1\">.*?</td><td\sclass=\"yfnc_tabledata1\">
       (.*?)</td><td\sclass=\"yfnc_tabledata1\">

to fetch the data out of the web page. Now, you are able to find out how hard was that.

Sites used for getting exchange rates

Sites used for getting stock market report

.NET Framework

The .NET Framework can be downloaded from the Microsoft website

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: VERY USEFUL Pin
Priyank Bolia30-May-05 18:26
Priyank Bolia30-May-05 18:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.