title: C# - Calling function from another form
body: <p>I need a tray notify from another form.
  ControlPanel.cs (default form, notifyicon here):</p>
  
  <pre><code>  ...
    public partial class ControlPanel : Form
      {
          public string TrayP
          {
              get { return ""; }
              set { TrayPopup(value, "test");}
  
          }
  
     public void TrayPopup(string message, string title)
      {
          TrayIcon.BalloonTipText = message;
          TrayIcon.BalloonTipTitle = title;
          TrayIcon.ShowBalloonTip(1);
      }
  </code></pre>
  
  <p>Form1.cs (another form):</p>
  
  <pre><code>...
  public partial class Form1 : Form
  {
  
      public ControlPanel cp;
      ....
  
      private void mouse_Up(object sender, MouseEventArgs e) {
          cp.TrayP = "TRAY POPUP THIS";
      }
  </code></pre>
  
  <p>On line <code>cp.TrayP = "TRAY POPUP THIS";</code> I am getting a NullException.
  If i change it to <code>cp.TrayPopup("TRAY POPUT THIS", "test");</code> an exception throws whatever.</p>
  
  <p>If i make this:</p>
  
  <pre><code>private void mouse_Up(object sender, MouseEventArgs e) {
      var CP = new ControlPanel();
      CP.TrayPopup("TRAY POPUP THIS", "test");
  }
  </code></pre>
  
  <p>, tray popup shows, but it`s creates the second tray icon and then show balloon hint from new icon. What can I do?
  P.S.: Sorry for bad English.</p>