In the Designer of my forms I usually have this for Singleton purposes.

C# Code:
  1. private static frmMainMenu  instance = null;
  2. public static frmMainMenu Instance()
  3. {
  4.     if (instance == null)
  5.     {
  6.         instance = new frmMainMenu();
  7.     }
  8.     return instance;
  9. }
  10. /// <summary>
  11. /// Clean up any resources being used.
  12. /// </summary>
  13. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  14. protected override void Dispose(bool disposing)
  15. {
  16.     if (disposing && (components != null))
  17.     {
  18.         components.Dispose();
  19.     }
  20.     base.Dispose(disposing);
  21.     instance = null;
  22. }

Is there any hack in the IDE that would let me just press a button or something and it will automatically add the code I have above to the selected Designer?

I can always type or copy/paste/modify it but I thought there could be something that I could set to just automate this redundant task.