title: float.TryParse not working
body: <p>I created program that calculates the currency exchange rate.
  The program has:</p>
  
  <ol>
  <li><em>ComboboxCurrencyName</em> - which displays the currency name.</li>
  <li><em>ComboCurrencyValue</em> - which displays the value of a given currency.</li>
  <li><em>txtYourValue</em> - textbox  which gets from user the amount of money</li>
  <li>Button that calculates the rate of the given currency with the amount of money given from user.</li>
  </ol>
  
  <p>My code:</p>
  
  <pre><code>public void EchangeRate(float x,float y)
  {
      label1.Text = (x * y).ToString();
  }
  
  private void button1_Click(object sender, EventArgs e)
  {
      if(comboCurrencyName.SelectedIndex==comboCurrencyValue.SelectedIndex)
      {
          float currency;
          float inputValue;
          if(float.TryParse(comboCurrencyValue.SelectedItem.ToString(),out currency)&amp;&amp; float.TryParse(txtYourValue.Text,out inputValue))
          {
              EchangeRate(currency,inputValue);
          }
      }
      else
      {
          MessageBox.Show("Not selected currency ");
      }
  }
  </code></pre>
  
  <p>When I select a given currency with a combobox and I'm entering the value to convert, nothing happens when I press the button. I think this is a problem with converting combobox to float value.</p>
  
  <p>Previously I used <code>float.Parse()</code> I had the error:</p>
  
  <blockquote>
    <p>System.FormatException: 'Invalid input string format.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/Zs7yN.png" rel="nofollow noreferrer">Breakpoint</a></p>
  
  <p><img src="https://i.stack.imgur.com/rzNqX.png" alt="Application window"></p>