title: I have a system task tray application - Can I close the main form instead of just hiding it?
body: <p>I have an application that has a main form and a system task tray icon. In the designer of the main form, I dragged the <code>TrayIcon</code> control on the form, so it is a child of the main form.</p>
  
  <p>At this point, when the user presses the close button on the main form, it actually just hides it so that the application wont terminate, unless the user right clicks the TrayIcon and clicks exit. But, the main form has a lot of controls and resources, and when the main form is hidden, it still uses memory for those resources. My goal is to actually dispose of form so it doesn't take up that memory while it is not being used.</p>
  
  <p>Unless I am mistaken, and when the main form is hidden it doesn't take up that memory anymore, but I don't think that is the case.
  I'm no expert on memory, I may even be completely mistaken on how memory management works, and thus this question is invalid.</p>
  
  <p>Anyways, if I am correct in that when the main form is only hidden it still takes up memory that can be freed by fully closing the form, is there a way for me to actually close the main form without the application terminating? If so, I would need to create the <code>TrayIcon</code> with code in the <code>Program</code> class instead of in the class of the main form, correct?</p>