title: Execute specified function every X seconds
body: <p>I have a Windows Forms application written in C#. The following function checks whenever printer is online or not:</p>
  
  <pre><code>public void isonline()
  {
      PrinterSettings settings = new PrinterSettings();
      if (CheckPrinter(settings.PrinterName) == "offline")
      {
          pictureBox1.Image = pictureBox1.ErrorImage;
      }
  }
  </code></pre>
  
  <p>and updates the image if the printer is offline. Now, how can I execute this function <code>isonline()</code> every 2 seconds so when I unplug the printer, the image displayed on the form (<code>pictureBox1</code>) turns into another one without relaunching the application or doing a manual check? (eg. by pressing "Refresh" button which runs the <code>isonline()</code> function)</p>