private SortedList<ToolStripMenuItem, Form> forms = new SortedList<ToolStripMenuItem, Form>(); private void MainForm_Load(object sender, EventArgs e) { formsAdd(menuCommandPrompt, new CommandPrompt()); formsAdd(menuLogScreen, new LogScreen());
I cannot understand why this is causing the error. The error occurs in the second line of the form load event.
The formsAdd method simply adds the form element and toolstip to the array (s) and sets the tag and form owner for this. The second time the function is called, it throws an error.
CommandPrompt, LogScreen Form

source share