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

18 Nov 20181 minute to read

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