Possibly the exception is thrown not through the
unloading of the form itself but due to some part of the
code in your form which call some other component.
To track down where the problem is, I suggest that you
put a breakpoint early in your code (e.g. in the load of
the form). Then step through the code and do whatever
action that you did before to cause the exception (your
dialog form must perform some action). When you find the
offending statement or call, it will perhaps be evident
what is wrong. If not, enclose the statement or section
of code in an error trapping structure:
Try
...
... ' statements that cause the error
...
Catch ex as Exception
MessageBox.Show(ex.Message)
End Try
This will give a more specific message of what is wrong
in the external component that your code is using.
Regards,
Frank M.