InfoConnect for Unisys VBA Guide
GetControlsByName Function
Name of control.
Gets a collection of controls by name.
Syntax
object.GetControlsByName( _
   ByVal name As String _
) As Object()

Parameters

name
Name of control.

Return Value

Returns a collection of controls whose names all match the

name

.
Example
Sub ToggleConnection()
'Give the Ibm terminal a name. This will provide ability to retrieve
'the session with Application.GetControlsByName.
'This could be done for each session, perhaps on AfterConnect event.
ThisIbmTerminal.Name = "IBMSession1"
            
'The following demonstrates getting a set of sessions/controls with a given name
Dim controls() As Variant 'An array of type Variant/Object/Terminal
'Return all controls named "IBMSession1"
controls = Application.GetControlsByName("IBMSession1")
            
If UBound(controls) = -1 Then
    Exit Sub
    Else
    'Toggle the connection state for all controls in array
        For i = 0 To UBound(controls)
        If controls(i).IsConnected Then
        controls(i).Disconnect
    Else
        controls(i).Connect
    End If
    Next i
End If
End Sub
See Also

 

 


2015 Attachmate

Send Feedback