65.9K
CodeProject is changing. Read more.
Home

Currency Convertor

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.13/5 (19 votes)

May 30, 2005

GPL3

1 min read

viewsIcon

86106

downloadIcon

975

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:


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

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