title: How to Only allow numbers and a Minus "-" in a Textbox
body: <p>I would like to know how I would be able to allow only <strong>numbers</strong> and a <strong>"-"</strong> minus sign in a textbox?</p>
  
  <p>Here is coding that I can already allow only numbers:</p>
  
  <pre><code>private void txtDicountSettlement_PreviewTextInput(object sender, TextCompositionEventArgs e)
  {
      Regex regex = new Regex("[^0-9]+");
      e.Handled = regex.IsMatch(e.Text);
  }
  </code></pre>