title: Is it a bad idea to give a C# form a static property pointing to the only instance of the same form?
body: <p>I have a fairly simple application that monitors folder activity and logs it on a server.
  In this application I start off with a Form object called Form1. On this form I have a NotifyIcon. Because I need to change the text in the BalloonTip of the NotifyIcon from different Forms along the way, I was thinking of setting a static property of Form1 that will point to the only instance of Form1. This is how it would look in my oppinion:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      private static Form1 staticRef;
      // Other private properties
  
      public Form1()
      {
          InitializeComponent();
          staticRef = this;
          // Rest of constructor logic
      }
      public static void changeNotifyBalloonText(String newText, int timeInMillis)
      {
          if (staticRef != null &amp;&amp; staticRef.notifyIcon1 != null)
          {
              staticRef.notifyIcon1.BalloonTipText = newText;
              staticRef.notifyIcon1.ShowBalloonTip(timeInMillis);
          }
      }
      // Rest of public and private methods
  }
  </code></pre>
  
  <p>Other things to be noted:</p>
  
  <p>a. There will never be more than 1 instance of Form1.</p>
  
  <p>b. I always check the value of staticRef against null, before trying to use it.</p>
  
  <p>c. I cannot afford to make a temporary, local instance of Form1 just to set a BalloonTip message.</p>
  
  <p>d. This solution works very well, i'm more interested in knowing if it's "too hacky" and if so - what would be a better approach to my issue?</p>
  
  <p>e. The closest thing I've found that may answer my question (about static properties) to some degree is here:
  <a href="https://stackoverflow.com/questions/7292054/is-using-a-static-property-in-a-form-bad-practice-knowing-that-theres-only-one">Is using a static property in a form bad practice knowing that there's only only one instance of the form?</a></p>