c# - How do I convert GBP to EUR? -


i have text box containing balance , text box want show balance in euros. when click convert button want able convert sterling euro.

so how balance display in streling , how convert euro?

any example code great or direct me site teach me this.

the european central bank (ecb) provides currency exchange rates on daily basis in xml format

link currency rates here

use webrequest save xml , write wrapper class conversion

and if want use xe.com use link, has 3 parameters 1.amount convert, 2. currency , 3. currency

output of link

  <wml>   <head>    <meta http-equiv="cache-control" content="must-revalidate" forua="true"/>    <meta http-equiv="cache-control" content="no-cache" forua="true"/>   </head>   <card  title="xe converter">    <p mode="wrap" align="center">     xe converter    </p>    <p mode="nowrap" align="left">100 sgd =</p>    <p mode="wrap" align="right">18,287.95 huf</p>    <p mode="wrap" align="center">      live @ 12:07 gmt    </p>     <p mode="nowrap" align="left">     <a href="step1.wml">another?</a><br/>     <a href="http://www.xe.com/wap/index.wml">xe home</a>    </p>   </card>   </wml> 

again use webrequest class , output , parse xml

sample here

    httpwebrequest myhttpwebrequest = null;     //declare http-specific implementation of webrequest class.         httpwebresponse myhttpwebresponse = null;   //declare http-specific implementation of webresponse class         xmldocument myxmldocument = null;           //declare xmlresponse document         xmltextreader myxmlreader = null;           //declare xmlreader          try         {             //create request             myhttpwebrequest = (httpwebrequest)httpwebrequest.create("http://www.xe.com/wap/2co/convert.cgi?amount=100&from=sgd&to=huf");             myhttpwebrequest.method = "get";             myhttpwebrequest.contenttype = "text/xml; encoding='utf-8'";              //get response             myhttpwebresponse = (httpwebresponse)myhttpwebrequest.getresponse();              //now load xml document             myxmldocument = new xmldocument();              //load response stream xmlreader             myxmlreader = new xmltextreader(myhttpwebresponse.getresponsestream());             myxmldocument.load(myxmlreader);         }         catch (exception myexception)         {             throw  myexception;         }                 {             myhttpwebrequest = null;             myhttpwebresponse = null;             myxmlreader = null;         } 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -