Connect Method

Description
Connects the Spel class instance with a Controller.

Syntax
Sub Connect (ConnectionName As String)
Sub Connect (ConnectionName As String, ConnectionPassword As String)
Sub Connect (ConnectionNumber As Integer)
Sub Connect (ConnectionNumber As Integer, ConnectionPassword As String)

Parameters

  • ConnectionName
    A character string indicating the connection name.
  • ConnectionNumber
    An integer indicating the connection number. The connection number is the number of the connection in the RC+ Setup \ [PC to Controller Communications] dialog. Specify a value of -1 to use the last successful connection.
  • ConnectionPassword
    A character string indicating the connection password. If the controller requires a password for connection but the password has not been configured in the RC+ Setup \ [PC to Controller Communications] dialog, you must set the password to connect with the controller.

Remarks
When a Spel class instance needs to communicate with the Controller, it automatically connects. If you want to explicitly connect to the Controller, use the Connect method.

See Also
Disconnect Method, Initialize Method

CAUTION


When you change the connection number in [PC to Controller Communications] dialog, the parameter value of this method "ConnectionNumber" will be affected. Review the RC+ API program.

Connect Example
VB Example:

  Try  
    m_spel.Tool(1)  
  Catch ex As RCAPINet.SpelException  
    MsgBox(ex.Message)  
  End Try  

C# Example:

try{  
    m_spel.Tool(1);  
}  
catch(RCAPINet.SpelException ex){  
    MessageBox.Show(ex.Message);  
}