title: Windows Forms Application is not responding
body: <p>I have created a Windows Forms Console Application in which I am reading a file which has been written by another console application.
  The other console application will write about the status of some process and the Windows Forms application will read the status and accordingly update the status text box.
  I wrote the following code for above scenario.</p>
  <pre><code>while (true)
  {
      if ((new FileInfo(filename)).Length &gt; 0)
      {
           Status = File.ReadAllText(filename, Encoding.ASCII);
           System.IO.File.WriteAllText(filename, string.Empty);
  
           Statustb.Text = Status;
           Statustb.Refresh();
                      
           if (Status.Equals(&quot;Data Got Loaded&quot;))
           {
               Environment.Exit(0);
           }
       }
   }
  </code></pre>
  <p>When I am running the Windows Forms application it shows &quot;Form Not Responding&quot; but when I comment out these lines then it will run smoothly. But for me it is important to update the status.</p>