title: C# Get Current Exchange Rate from XE
body: <p><br>
  I need to display current exchange rates on my application.<br>
  Is it possible to retrieve the exchange rate from <a href="http://www.xe.com" rel="nofollow noreferrer">http://www.xe.com</a> (XE Converter)<BR>
  Here what I tried: <br></p>
  
  <pre><code>public string CurrencyConversion(decimal amount, string fromCurrency, string toCurrency)
          {
              string Output = "";
               string fromCurrency1 = comboBox1.Text;
               string toCurrency1 = comboBox2.Text;
               decimal amount1 = Convert.ToDecimal(textBox1.Text);
  
              // For other currency symbols see http://finance.yahoo.com/currency-converter/
              // Construct URL to query the Yahoo! Finance API
  
              const string urlPattern = "http://finance.yahoo.com/d/quotes.csv?s={0}{1}=X&amp;f=l1";
              string url = string.Format(urlPattern, fromCurrency1, toCurrency1);
  
              // Get response as string
              string response = new WebClient().DownloadString(url);
  
              // Convert string to number
              decimal exchangeRate =
                  decimal.Parse(response, System.Globalization.CultureInfo.InvariantCulture);
  
              // Output the result
              Output = (amount1 * exchangeRate).ToString();
              textBox2.Text = Output;
  
              return Output;
          }
  </code></pre>
  
  <p>With this code I am not having the full output... the decimal part is not<br>showing...</p>