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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -