Ben Armstrong continues his Virtual Server development series, this time explaining how to handle events from a managed application:
- Setup the managed application appropriately to talk to the Virtual Server COM interfaces
- Declare your Virtual Server COM object ‘WithEvents’ as follows:
- Create a subroutine to catch the event:
Private WithEvents virtualServer As VMVirtualServer = Nothing
instead of:
Private virtualServer As VMVirtualServer = Nothing
Public Sub virtualServer_EventLogged(ByVal logMessageID As Integer) Handles virtualServer.OnEventLogged
‘Do something with the event
msgbox(CStr(logMessageID))End Sub
You should read the original post for helpful comments and further explainations from Ben.