Eval

Eval(pExpression)

The Eval is the simple version of execute. It takes a simple expression, runs it and returns the value:

'Call RunCustomAction with ActionNames 'Add', 'Remove' or 'Reset'
Public Function RunCustomAction(pContext, pActionName As String)
   pActionName = CleanupString(pActionName, "-Name-") 'Sanitizes the name
   Return Eval($"CustomAction_{pActionName}(pContext)")
End Function

Private Function CustomAction_Add(pContext)
  'Do some action
End Function

Private Function CustomAction_Remove(pContext)
  'Do some action
End Function

Private Function CustomAction_Reset(pContext)
  'Do some action
End Function

A saying is 'Eval is Evil'. This means that you must be very aware of the source your Eval statement is working with. Nonetheless, Eval can be very useful for things like custom events.

The eval statement is fired 'in place', allowing it to access local variables from the calling procedure.

See also: