This method is used in conjunction with the WebX Server event CallFunction. In the CallFunction event the data that is to be returned as the function result is done so using this method.
Private Sub WebX1_CallFunction(Index As Integer, FunctionName As String)
' Index - The connection number that requested
' the function. Index has to be passed back
' to WebX when using the .ReturnData method.
' sFunctionName - The name of the function called from HTML.
On Error GoTo eh
Debug.Print WebX1.QueryString(Index, "")
' In the Demo App we use the Select statement
' to decide which function to call. This
' allows the Function name in the HTML to be different
' than the App function name.
' As seen below, "MyFunction" is the name of
' the function in HTML, but the name of the
' VB function actaully called is "TestFunction"
Select Case FunctionName
Case "MyFunction", "TestFunc"
WebX1.ReturnData Index, TestFunction()
WebX1.ReturnData Index, TestFunctionError()
' If the function does not exists, send
' something back, either "" or a
' message saying that the function was not
' found. This will depend if errors should
' be masked (hidden) from users, or if they
' should be exposed to the user.
'WebX1.ReturnData Index, ""
WebX1.ReturnData Index, "Error: " & _
The Function Call failed. Function " & _
FunctionName & " was not found."