Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Terminal Object / ConnectionType Property
Example
ConnectionType Property
Gets or sets the connection type.
Syntax
expression.ConnectionType As ConnectionTypeOption
where expression is a variable that represents a Terminal Object

Property Value

A ConnectionTypeOption value
Remarks
When you use this property to set a connection type, all connection settings for that type (that is, all settings that you can configure with the ConnectionSettings property) are reset to their default values.

If you're writing a procedure that manipulates the current data connection settings, you may want to determine the current connection type with this property before making changes to the connection settings. After determining the current connection type, use the ConnectionSetting method to retrieve the value of a single connection keyword token, or the ConnectionSettings property to retrieve or set any or all of the connection keyword tokens.

If you're writing a procedure that manipulates the current data connection settings, you may want to determine the current connection type with this property before making changes to the connection settings. After determining the current connection type, use the ConnectionSetting method to retrieve the value of a single connection keyword token, or the ConnectionSettings property to retrieve or set any or all of the connection keyword tokens.

If a connection is already active and you try to set the connection type, a runtime error results. You should either trap the error using an error-handing routine, or use the IsConnected property to first determine if a connection is active.

The default value is "BEST-NETWORK".
Example
'This example switches a connection from telnet to SSH and saves the session
Sub ConnectExample()
 
    If ThisTerminal.connectionType = ConnectionTypeOption_Telnet Then
        'First disconnect so you can change the settings
        ThisTerminal.Disconnect
    
        'Change the connection type
        ThisTerminal.connectionType = ConnectionTypeOption_SecureShell
        
        'Reconnect and save with the new settings
        ThisTerminal.Connect
        ThisTerminal.Save
    End If
 
End Sub
This example displays the connection type in a YESNO message box that allow you to decide whether to connect.
'To run this example, copy it to the ThisTerminal code window
Private Function Terminal_Connecting(ByVal sender As Variant, ByVal ConnectionID As Long, ByVal connnectionType As Attachmate_Reflection_Objects_Emulation_OpenSystems.ConnectionTypeOption, ByVal connectionSettings As Variant) As Boolean
           
    Dim msg As String 'the message to include in the dialog box
    
    'Get the connection type and include it in the message
    Select Case connectionType
    
        Case ConnectionTypeOption_None
            msg = "There is no connection currently configured. Do you want to connect?"
        
        Case ConnectionTypeOption_BestNetwork
            msg = "The connection type is " & "BestNetwork? " & "Do you want to connect?"
    
        Case ConnectionTypeOption.ConnectionTypeOption_SecureShell
            msg = "The connection type is " & "SecureShell? " & "Do you want to connect?"
    
        Case ConnectionTypeOption.ConnectionTypeOption_Telnet
            msg = "The connection type is " & "Telnet? " & "Do you want to connect?"
        
        Case ConnectionTypeOption.ConnectionTypeOption_VT_MGR
            msg = "The connection type is " & "VT_MGR. " & "Do you want to connect?"
        
        Case Else
        msg = "Do you want to connect?"
      
    End Select
    
    'Display a message box and get the user response
    confirm = MsgBox(msg, vbYesNo)
 
    'Depending on the response, allow or disallow connecting
    If confirm = vbYes Then
 
        Terminal_Connecting = True
 
    Else
 
        Terminal_Connecting = False
 
    End If
 
End Function
See Also