title: How to abort a while loop by clicking a button using C#
body: <p>I have a function that displays numbers using a while loop but I want to stop execution of a while loop at random variable value using c# by clicking a button.</p>
  
  <p>For Example:  </p>
  
  <pre><code>private void FrqSent()
  {
      int i = 1;
      while (i &lt;= 5)       
      {  
          i = i + 1;
      }  
  }
  </code></pre>