Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmTerminal Object / AfterConnect Event
Example
In This Topic
AfterConnect Event
In This Topic
Occurs after Reflection connects to the host.
Syntax
private Sub IbmTerminal_AfterConnect ( 
   ByVal sender As Object _
) 

Parameters

sender
Sender of event.
Example
These examples show several ways to use the AfterConnect event.
This example opens the Transfer dialog box after the session connects. To run this sample, copy this code to the IbmTerminal code window.
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
        ThisIbmTerminal.FileTransfer.ShowFileTransferDialog
End Sub
This example defines an event that occurs when there is no host activity for 30 seconds and handles the event to disconnect the session.
'Place this code in the ThisIbmTerminal code window
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
    
    ThisIbmScreen.ClearEvents
 
    'Define an event that occurs when there is no host activity for 30 seconds
    ThisIbmScreen.DefineEvent 1, DefinedEventType_Silence, "00:00:30", " ", 0, 0
    
End Sub
 
'Place this code in the ThisIbmScreen code window. The following procedure is executed when a defined event triggers.
Private Sub IbmScreen_DefinedEvent(ByVal EventNumber As Long, ByVal EventType As Attachmate_Reflection_Objects_Emulation_IbmHosts.DefinedEventType, ByVal TheString As String, _
     ByVal row As Long, ByVal column As Long)
    
    'If the host is inactive for the specified interval, disconnect
    If EventNumber = 1 Then
    
        ThisIbmTerminal.Disconnect
        
    End If
    
End Sub
This example changes the session tab text to the host address and port when a session connects. To run this example, copy this code to the ThisIbmTerminal code window.
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
Dim Port As Integer
Dim Address As String
 
    With ThisIbmTerminal
    
    
        Address = .HostAddress
        
        Port = .Port
    
        ThisView.titleText = ThisIbmTerminal.HostAddress & " on " & ThisIbmTerminal.Port
        
    End With
 
End Sub
See Also