I'm working on an MDI application that loads "Modules" for users to work with.
It is simply a front end to the user forms which are part of various class libraries that it loads during startup.
I'm loading the DLLs at runtime using System.Reflection.Assembly
then setting a Form variable to equal the form within the DLL and adding it to the MDI window.
The problem is that I'm not quite sure how to go about catching unhandled errors that happen in the class library itself. If there's an error in one of the child windows from the class library the entire application crashes.
Ideally, all of the DLLs would handle their own errors, but obviously I'd like to handle any "unknowns" in the main front end just in case.
Recap - I'm creating an instance of a form from a class library using Assembly.LoadFile, and displaying it in an MDI window. If the form encounters an error within itself it brings down the entire application.
Below is a simple example of how I am loading the form.
Any assistance would be greatly appreciated!
Dim Assembly As System.Reflection.Assembly = _
//(All libraries have a frmModule so the front end knows what to load.)"
Dim MDIChild As Form = _
Assembly.CreateInstance(ModuleFileNameWithoutPath & ".frmModule")
MDIChild.MdiParent = Me