title: Create a status bar?
body: <p>I am moving rows from a table from one server to another another using a C# script. Please don't tell 
  me to use SSIS components for that. I am looping the incoming dataset using 
  a for loop and I want to see the current iteration, ie for loop index in a GUI
  box. I can use <code>MessageBox.Show("Text")</code>, but I need to press ok/cancel to allow
  the code to continue. So, I thought of using a status bar instead. I tried <a href="http://www.c-sharpcorner.com/uploadfile/mahesh/statusbar-in-C-Sharp/" rel="nofollow">an 
  example I got online</a></p>
  
  <p>The line <code>this.Controls.Add(mainStatusBar);</code> in the example (below) causes the error -   </p>
  
  <blockquote>
    <p>csproj.ScriptMain' does not contain a definition for 'Controls' 
        and no extension method 'Controls' accepting a first argument of type 
        '.csproj.ScriptMain' could be found (are you missing a using directive 
        or an assembly reference?) </p>
  </blockquote>
  
  <p>This happens despite adding the reference - <code>System.Windows.Forms.dll</code> and doing a 
  save all (ie <code>Ctrl+Shift+S</code>). The script has a import using <code>System.Windows.Forms;</code> 
  already. </p>
  
  <p>Why am I getting this error and how do I fix it ?</p>
  
  <p><strong>Code -</strong></p>
  
  <pre><code>protected StatusBar mainStatusBar = new StatusBar();
  protected StatusBarPanel statusPanel = new StatusBarPanel();
  protected StatusBarPanel datetimePanel = new StatusBarPanel();
  
  private void CreateStatusBar()
  {
      // Set first panel properties and add to StatusBar
      statusPanel.BorderStyle = StatusBarPanelBorderStyle.Sunken;
      statusPanel.Text = "Application started. No action yet.";
      statusPanel.ToolTipText = "Last Activity";
      statusPanel.AutoSize = StatusBarPanelAutoSize.Spring;
      mainStatusBar.Panels.Add(statusPanel);
  
      // Set second panel properties and add to StatusBar
      datetimePanel.BorderStyle = StatusBarPanelBorderStyle.Raised;
      datetimePanel.ToolTipText = "DateTime: " + 
      System.DateTime.Today.ToString();
      datetimePanel.Text = System.DateTime.Today.ToLongDateString();
      datetimePanel.AutoSize = StatusBarPanelAutoSize.Contents;
      mainStatusBar.Panels.Add(datetimePanel);
  
      mainStatusBar.ShowPanels = true;
      // Add StatusBar to Form controls
      this.Controls.Add(mainStatusBar);
  
  }
  
  private void button1_Click(object sender, EventArgs e)
  {
      statusPanel.Text = "Button is clicked.";
  }
  
  private void checkBox1_CheckedChanged(object sender, EventArgs e)
  {
      statusPanel.Text = "CheckBox is checked.";
  }
  
  private void textBox1_TextChanged(object sender, EventArgs e)
  {
      statusPanel.Text = "TextBox edited.";
  }
  </code></pre>