How to generate error messages or exceptions while performing String-related calculations?

Normally the CalcEngine will not display an invalid error message or exception while performing mathematical operations with string or text. To generate an invalid error message or exception, the TreatStringAsZero property must be set to false.

For example, if a string is multiplied with a number (for example, ”text” * 10), the calculated result will be zero. But, if the TreatStringAsZero property is set to false, the “#VALUE!” exception will be generated.

  • c#
  • this.engine.TreatStringsAsZero = false;
  • vbnet
  • Me.engine.TreatStringsAsZero = False