title: Refresh a windows form, even when not the active window
body: <p>I am trying something quite basic.</p>
  
  <p>I have 3 labels on my windows form, which I would like to populate from 3 separate queries from the database, but also to show the user that something is happening, I would like to show each label as the data is available from the respective query.</p>
  
  <p>To do this, I can use:</p>
  
  <pre><code>Form.ActiveForm.Refresh();
  </code></pre>
  
  <p>However, if the user clicks on any other window on their desktop, that command fails, with the "object not set" error.</p>
  
  <p>Is there any way that I can refresh the labels on the Form, even if the form window is not the active window?</p>
  
  <pre><code>// Breach within next hour
  DataTable tbBreach = (get info from database)
  tbBreach.DefaultView.Sort = "Assignee ASC";
  dgBreach.DataSource = tbBreach;
  lbBreach2.Text = tbBreach.Rows.Count.ToString();
  Form.ActiveForm.Refresh();  //Would like to update this form field now, and show it on the form
  
  // Breach within next 24 hour
  DataTable tbBreach24 = (get info from database)
  tbBreach24.DefaultView.Sort = "Assignee ASC";
  dgBreach24.DataSource = tbBreach24;
  lbBreach24.Text = tbBreach24.Rows.Count.ToString();
  Form.ActiveForm.Refresh();
  </code></pre>
  
  <p>Thank you,</p>
  
  <p>Mark</p>