Imports System Imports uCalcSoftware Public Module Program Public Sub ValidateValue(ByVal cb As uCalc.Callback) Dim val = cb.Arg(1) If val > 100 Then '// The error message includes the problematic value, making it dynamic. cb.Error.Raise("Value exceeds maximum of 100. Got: " + val.ToString()) Else cb.Return(val) End If End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("CheckValue(val)", AddressOf ValidateValue) Console.WriteLine(uc.EvalStr("CheckValue(50)")) Console.WriteLine(uc.EvalStr("CheckValue(123)")) End Sub End Module