title: Calculating textbox with two selected combobox items
body: <p>My problem: Id like to , after two  combobox variables are selected, to divide these two and set the Textbox to the result of the calculation.</p>
  
  <p>The two Comboboxes: Körpergröße &amp; Gewicht</p>
  
  <p>The textbox: BMI</p>
  
  <p>First of all, the code im using ( which apparently isnt working now)</p>
  
  <pre><code>    private void fillTextBox(float value1, float value2)
     {
         BMI.Text = (value1 / value2).ToString();
     }
  
      private void Körpergröße_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          float a;
          float b;
          //In this way you can compare the value and if it is possible to convert into an integer. 
          if (float.TryParse(Körpergröße.SelectedItem.ToString(), out a) &amp;&amp; float.TryParse(Gewicht.SelectedItem.ToString(), out b))
          {
  
              fillTextBox(a, b);
          }
  
  
      }
  
      private void Gewicht_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          float a;
          float b;
          //In this way you can compare the value and if it is possible to convert into an integer. 
          if (float.TryParse(Körpergröße.SelectedItem.ToString(), out a) &amp;&amp; float.TryParse(Gewicht.SelectedItem.ToString(), out b))
          {
  
              fillTextBox(a, b);
          }
      }
  </code></pre>
  
  <p>The default values of the two comboboxes are strings.. ("Bitte auswählen")</p>
  
  <p>Pictures how it looks like now. After two int values are selected, the result of the calculation should appear in the BMI Textbox, but its still blank. it looks like the ToString() Methods do not save into a, and neither into b..therefore the values cant be used in the fillTextBox method</p>
  
  <p><a href="https://i.stack.imgur.com/EdmH1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EdmH1.png" alt="enter image description here"></a></p>
  
  <p>It would be nice if someone could answer me with a code with some sidenotes, in order for me to understand..</p>
  
  <p>Thanks in advance!</p>