title: While Loop with Ping Commands
body: <p>I'm having trouble with a really simple program I'm making. I want it so that when I click btnPing, it will send a ping to google.com every 1 second and return the ping in milliseconds. It works perfectly until I want to loop the action. Outside of the while loop, the code works, but requires me to click the button every time I want to send a ping. But when I put the code in a loop, it freezes. I've tried it with a for loop and a while loop. The program is returning no errors. What is making my program freeze?  </p>
  
  <pre><code>Ping pingClass = new Ping();
  
  private void btnPing_Click(object sender, EventArgs e)
  {
      while (true)
      {
          PingReply pingReply = pingClass.Send("google.com");
          rtxtPing.Text = rtxtPing.Text + "\r\n" + (pingReply.RoundtripTime.ToString() + "ms");
          System.Threading.Thread.Sleep(1000);
      }
  }
  </code></pre>