title: Using a timer to delay a line by line readline method C#
body: <p>I am using C# Windows Forms using Visual Studio 2010.  Don't let the Console part confuse you it's a user defined thing not the actual console.  So I have a method that prints a file line by line.  I have to make it appear to print slowly so I am currently using Thread.Sleep to slow the line by line printing.  I cannot use this because it freezes up some other components in the program.  I was hoping to see if this could be done with a timer instead.  Though all the examples I see being used with a timer generally have a method being called by the timer.  Not have a timer delay in the middle of a method.  So I'm not sure how I can go about using a timer here.</p>
  
  <hr>
  
  <pre><code>public void SlowPrint(string FileName)
  {
  
      string line;
  
      string tempFileName;
  
      string MyFilesDir = "..\\..\\myFolder\\";
  
      tempFileName = Path.Combine(MyFilesDir, FileName);
  
      if (System.IO.File.Exists(tempFileName))
      {
          System.IO.StreamReader file = new System.IO.StreamReader(tempFileName);
  
          while (((line = file.ReadLine()) != null))
          {
              Console.WriteLine(line);
              System.Threading.Thread.Sleep(700);  //This has to go
          }
          file.Close();
      }
      else
      {
          Console.WriteLine("Error " + tempFileName + " does not exists");
      }
      Console.ReadLine();
  }//end SlowPrint method
  </code></pre>