title: how to currency format under textbox?
body: <p>I want enter number in textbox, an my textbox convert automatically it in comma(,) format. I have tried to do this, but it works wrong. Help me? Like this 1,20(I JUST ENTER 120);</p>
  
  <pre><code>private bool IsNumeric(int Val)
  {
      return ((Val &gt;= 48 &amp;&amp; Val &lt;= 57) || (Val == 8) || (Val == 46));
  }
  String str;
  private void textBox1_KeyDown(object sender, KeyEventArgs e)
  {
      int KeyCode = e.KeyValue;
      if (!IsNumeric(KeyCode))
      {
          if (KeyCode == 13)
          {
              e.Handled = true;
              vendas();
              str = null;
          }
          e.Handled = true;
          return;
  
      }
      else
      {
          e.Handled = true;
      }
      if (((KeyCode == 8) || (KeyCode == 46)) &amp;&amp; (str.Length &gt; 0))
      {
          str = str.Substring(0, str.Length - 1);
      }
      else if (!((KeyCode == 8) || (KeyCode == 46)))
      {
          str = str + Convert.ToChar(KeyCode);
      }
  
      if (str.Length == 0)
      {
          textBox1.Text = "";
      }
      if (str.Length == 1)
      {
          textBox1.Text = "0,0" + str;
      }
      else if (str.Length == 2)
      {
          textBox1.Text = "0," + str;
      }
      else if ((str.Length &gt; 2) &amp;&amp; (str.Length != 6) &amp;&amp; (str.Length != 9) &amp;&amp; (str.Length != 12))
      {
          textBox1.Text = str.Substring(0, str.Length - 2) + "," + str.Substring(str.Length - 2);
          textBox1.Text = textBox1.Text;
      }
      else if ((str.Length &gt; 6) &amp;&amp; (str.Length != 8) &amp;&amp; (str.Length != 10) &amp;&amp; (str.Length != 12))
      {
          textBox1.Text = str.Substring(0, str.Length - 3) + "," + str.Substring(str.Length - 1);
          textBox1.Text = textBox1.Text;
      }
  }
  </code></pre>
  
  <p>It shows me 10,01 instead 0,01?</p>