Presumably, you are creating a new instance of MainForm
in the constructor in WICForm
(or from some code called from within it).
That way the MainForm
and WICForm
classes are calling and constructing new instances of each other recursively, which will result in a stack overflow exception.
Tip: Put a breakpoint on the line containing new WICForm();
(place the cursor on that line and press F9
). When you run the code in debug mode now, you can step into that method to see what it does.