title: Need two different textbox's to only allow numbers 0-9 and 1 decimal place
body: <p>OK all my of code is working to this point. But I am unable to enter a decimal place in textbox1 and textbox3. I also only want the numbers 0-9 to be able to be entered in those textbox's. So far everything to this point is working for me but when I enter a "." I get a error. I think once I get the decimal to be able to be entered I am sure I can add the negitive sign as well. I think I need to use e.KeyChar correct?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace TemperatureConversion
  {
      /// &lt;summary&gt;
      /// A program that turns Fahrenheit to Celsius.
      /// &lt;/summary&gt;
  
      public partial class TemperatureConversionGYG : Form
      {
          // Varable for the calculatedCelsius output in textbox2
          float calculatedCelsius;
  
          // Varable for the Fahrenheit entered in textbox1.
          float originalFahrenheit;
  
          // Varable for the Celsius entered in textbox3.
          float originalCelsius;
  
          // Varable for the calculated fharenheit when user enters celsius to turn into fharenheit.
          float calculatedTemperatureFahrenheit;
  
          public TemperatureConversionGYG()
          {
              InitializeComponent();
          }
  
          public void button1_Click(object sender, EventArgs e)
          {
              // When this button is clicked it will use the number the user inputs in textbox1(FahrenheitNumber) to 
              // calculate the degree celsius and output it in textbox2. 
              calculatedCelsius = (originalFahrenheit - 32) / 9 * 5; 
  
              //Code here to send the calculatedCelsius to textbox2
              textBox2.Text = calculatedCelsius.ToString();
          }
  
          public void textBox1_TextChanged(object sender, EventArgs e)
          {
              // originalFahrenheit that the program will read and convert it to a float when user inputs a number.
              originalFahrenheit = Convert.ToInt32(textBox1.Text);
          }
  
          public void textBox2_TextChanged(object sender, EventArgs e)
          {
              // Need this box to accept 1 decimal. example 7.2, 55.5, 99 
          }
  
          private void Twitter_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
          {
              // Navigate to a URL.
              System.Diagnostics.Process.Start("https://twitter.com/GYGamers");
          }
  
          private void textBox3_TextChanged(object sender, EventArgs e)
          {
              // originalCelsius that the program will read and convert it to a float when user inputs a number.
              originalCelsius = Convert.ToInt32(textBox3.Text);
          }
  
          private void button2_Click(object sender, EventArgs e)
          {
              // This turns origianlCelsius to Fahrenheit.
              calculatedTemperatureFahrenheit = (originalCelsius * 9) / 5 + 32;
  
              //Code here to send the calculatedTemperatureFahrenheit to textbox4
              textBox4.Text = calculatedTemperatureFahrenheit.ToString();
          }
  
          private void textBox4_TextChanged(object sender, EventArgs e)
          {
              // Need this box to  accept  1 decimal. example 7.2, 55.5, 99 
          }
      }
  }
  </code></pre>