title: Validation-Textboxes allowing only decimals
body: <p>I am using following code for validating textbox.</p>
  
  <pre><code>private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  {
      e.Handled = SingleDecimal(sender, e.KeyChar);
  }
  
  public bool SingleDecimal(System.Object sender, char eChar)
  {
      string chkstr = "0123456789.";
      if (chkstr.IndexOf(eChar) &gt; -1 || eChar == Constants.vbBack) 
      {
          if (eChar == ".") 
          {
              if (((TextBox)sender).Text.IndexOf(eChar) &gt; -1) 
              {     
                  return true;
              }
              else 
              {         
                  return false;  
              }
          }   
          return false;
       }
       else 
       {
           return true;  
       }
  }
  </code></pre>
  
  <p>Problem is Constants.vbBack is showing error.If i didnt use  Constants.vbBack,backspace is not workimg.What alteration can i make to work backspace.Can anybody help?</p>