title: !Regex.IsMatch is not working in window form using csharp
body: <p>I am applying regex on my window form using c#. but regular expression on field is not working</p>
  
  <pre><code>if (txtRefno.Text == "" &amp;&amp; !Regex.IsMatch(txtRefno.Text, @"^[0-9]+$"))
  {
      msg.Text = "reference no. contain Invalid characters";
  }
  </code></pre>
  
  <p>but its not working and accept everything.<br>
  I changed the pattern to <code>"^[0-9]+$"</code> but same result I receive; then I changed the condition of <code>regex.IsMatch(inputstring, pattern) == false;</code> then error should be displayed, but it also doesn't work for me.</p>