title: Timer/Refresh functionality for text box
body: <p>In my application, I have two text boxes accompanied with two labels: "Connected" and "Not Connected". As seen in my code, if a connection is established, the "Connected" text box will fill with Green, indicating a network connection. It will be red if not. </p>
  
  <p>The functionality of connection detection is working just fine, however, I have to re-open the application for it to detect the change. I am looking for a way to refresh the application every 5-10 seconds or so automatically to detect any change in connectivity. I don't want to flush out the contents of any other field or box, just the color text boxes. A soft polling loop so to speak. How would I go about doing this using the Timer method. Should I create a new thread in which to run the timer and refresh the box?</p>
  
  <p>Thanks.</p>
  
  <pre><code>  if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == false)
          {
              noConnect.Select();  //if not connected, turn box red
              noConnect.BackColor = Color.Red;
  
          }
  
          else
          {
              netConnect.Select();  // if connected, turn box green
              netConnect.BackColor = Color.Lime;
  
          }
  
          //need to refresh box/application without losing other box/field contents 
          //in order to constantly check connectivity around 5-10 seconds or so
          //constantly check connectivity 
  </code></pre>