Call Method

Description
Calls (executes) a SPEL+ function which can optionally return a value.

Syntax
Function Call (FuncName As String [, Parameters As String]) As Object

Parameters

  • FuncName
    Function name to call
    Parameters Optional. Specify a list of arguments. Use arguments separated by commas (,).

Return Value
The return value of the SPEL+ function.
The data type matches the data type of the function.

Remarks
Use the Call method to call a SPEL+ function and retrieve the return value. When assigning the result of Call to a variable, ensure that the correct data type is used, otherwise a type mismatch error will occur.
You can also call DLL functions declared in your SPEL+ code from your Visual Basic application.

Note


To stop the function executed by Call Method, use Stop Method.
With Stop Method, the return value of Call Method becomes null.
The function executed by Call Method cannot be paused by Pause or Halt Method.
If you need to pause, use Xqt Method.

See Also
Xqt Method

Call Example

' Visual Basic Code  
Dim errCode As Integer  
errCode = m_spel.Call("GetPart", """Test"",2")  
  
// C# Code  
int errCode;  
errCode = m_spel.Call("GetPart", """Test"",2");  
  
' SPEL+ function  
Function GetPart(Info$ As String, Timeout As Integer) As Integer  
    Long errNum  
OnErr GoTo GPErr  
    Print Info$  
    errNum = 0  
    Jump P1  
    On vacuum  
    Wait Sw(vacOn) = On, Timeout  
    If TW = True Then  
        errNum = VAC_TIMEOUT  
    EndIf  
  
    GetPart = errNum  
    Exit Function  
GPErr:  
    GetPart = Err  
Fend