开发者

How do i convert String to currency?

i am using 2 web services:

http://www.webservicex.com/currencyconvertor.asmx?WSDL

http://www.oorsprong.org/websamples.countryinfo/CountryInfoService.wso

One the second webservice i used ListOfCurrenciesByCode m开发者_如何学运维ethod and got the isoCode of currency and listed it in a dropdownlist1.DataTextField = "sISOCode"; and i get all the countries' ISOCODE.

Now i want to convert values using first link webservice using webmethod ConversionRate. How do i convert ?the ConversionRate method only seems to want me to input

 ConversionRate(Currency fromcurrency, Currency tocurrency).

How do i do that?


String.Format("{0:C}", value);

Documentation: http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx


Taken from here

public string getConversionRate(string CurrencyFrom, string CurrencyTo)
{
   CurrencyConvertor curConvertor = new CurrencyConvertor();
   double rate = curConvertor.ConversionRate(
      (Currency)Enum.Parse(typeof(Currency), CurrencyFrom),
      (Currency)Enum.Parse(typeof(Currency), CurrencyTo));
   return rate.ToString();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜