title: Form freezes during while loop
body: <p>I have a piece of code that checks if a certain application is running</p>
  
  <pre><code>while (Process.GetProcessesByName("notepad").Length == 0)
  {
       System.Threading.Thread.Sleep(1000);
  }
  </code></pre>
  
  <p>It will check if the user is running notepad but it makes the form freeze and stop responding after a few seconds. I don't know if there is a better solution to fix this problem.</p>