This article was previously published under Q138140
This article has been archived. It is offered "as is" and will no longer be updated.
Untrapped errors in any events (like Initialize and Terminate) in anin-process OLE DLL server created in Visual Basic will cause it toterminate the whole process.
If you don't have an On Error Goto statement inside an Event procedure inan in-process OLE DLL server created in Visual Basic and an error occursinside the event procedure, Visual Basic will call the ExitProcess WindowsAPI to terminate the process that loaded the DLL. This will happenregardless of the Error trapping setting on the Advanced tab when you clickOptions on the Tools menu and regardless of whether the client is runningin the Visual Basic IDE or as a separate EXE.
Errors in event handlers of forms or controls created by the OLE DLL alsohave the same problem. For example, if the OLE DLL brings up a modal formand the user clicks on the form, an untrapped error in the Form_click eventwill cause the entire process to terminate.
However, this does not apply to errors that occur in property procedures ormethods of objects in the DLL. If these errors are not trapped in the DLLthey will be sent on to the client application that called the procedure.