title: TextBox enable to add only numbers - C#
body: <p>I have read a lot of code examples in this subject but it doesnt work. It should be no problem but it failed in my project where in other people project it work.
  I have text box in C# that should be contains only numbers.
  In my project if i have a text box with text : </p>
  
  <pre><code>-----------------------
  |         32          |
  |                     |
  ----------------------|
  </code></pre>
  
  <p>and i add a char " T" my resualt is :</p>
  
  <pre><code>-----------------------
  |         T3          |
  |                     |
  ----------------------|
  </code></pre>
  
  <p>It remove the first char instead the last char
  My code :</p>
  
  <pre><code>private void txt_NumOfIkun_KeyPress(object sender, KeyPressEventArgs e)
      {
          char charAdded = e.KeyChar;
  
          if (txt_NumOfIkun.TextLength &gt; 1)
                  txt_NumOfIkun.Text = txt_NumOfIkun.Text.Substring(0, txt_NumOfIkun.TextLength - 1);
              else
                  txt_NumOfIkun.Text= "";
      }
  </code></pre>