IServerDisconnect  Example

This example demonstrates using the IServerDisconnect interface from the Servers collection to catch the OnDisconnect event in Visual Basic.  The example uses a form with two buttons.  The first button signs up for the events.  The second button does an Open and Close on the Server which causes the OnDisconnect event to be fired.

Note, one could also sign up for the event from the Server object by setting the IServerDisconnect object to the Server object ( Set isrvdis = srv ). 


Option Explicit
Dim WithEvents srvdisc As ServerDisconnectEvents 
Dim srv As Server

Private Sub Command1_Click()
   Set srv = Servers.DefaultServer 
   Dim isrvdis As IServerDisconnect 
   Set isrvdis = Servers
   Set srvdisc = isrvdis.DisconnectEvents 
End Sub

Private Sub Command2_Click() 
End Sub

Private Sub srvdisc_OnDisconnect(ByVal pServer As PISDK.Server) 
	MsgBox "disconnected from " + pServer.Name 
End Sub 
Enabling Operational Intelligence