This example displays a message box that asks the user to confirm a user-initiated disconnection. If the user clicks No, the connection remains open.
Private Sub Session_BeforeUserDisconnect(Continue As Boolean)
If MsgBox("End this session?", vbYesNo) = vbNo Then
Continue = False
End If
End Sub