title: C# - e.KeyChar != '.' not working
body: <p>In my Windows Forms application I have a TextBox and applied to it the KeyPress event to accept just numbers. In the moment, my script is this way:</p>
  
  <pre><code>    if (!char.IsControl(e.KeyChar)
          &amp;&amp; !char.IsDigit(e.KeyChar) 
          &amp;&amp; e.KeyChar != '.')
      {
          e.Handled = true;
      }
  </code></pre>
  
  <p>The problem is that in <code>e.KeyChar != '.'</code> it doesn't work, my TextBox is accepting numbers and dots. I don't understand why because I say to the script that if the pressed key be different of dot (.), then doesn't input it. Some examples of values I'm receiveing are:</p>
  
  <ul>
  <li><strong>x8361</strong> - Doesn't accept </li>
  <li><strong>56491</strong> - Accept</li>
  <li><strong>15466.5</strong> - Accept : This is the failure. It might not accept but <code>!=</code> doesn't do anything there.</li>
  </ul>