Trying to close all forms except for the main menu using
FormCollection formsList = Application.OpenForms;
with a foreach loop and saying,
Collection was modified; enumeration operation may not execute.
FormCollection formsList = Application.OpenForms; //for (int i = 0; i < formsList.Count; i++) foreach(Form f in formsList ) { if (f.Name != "Form1" || f.Name != "Home" || f.Name != "AdminHome") f.Close(); } this.Close();