Evaluate string

  • Thread starter Thread starter J. van Herten
  • Start date Start date
J

J. van Herten

I am searching for the replacement of the scriptcontrol of VB6 in .NET.
I am plaing with the CodeDOM but I cannot get to evaluate a string text to
the result I want.

String text = "1 + 2"
Result shoul be 3.
 
I am searching for the replacement of the scriptcontrol of VB6
in .NET. I am plaing with the CodeDOM but I cannot get to
evaluate a string text to the result I want.

String text = "1 + 2"
Result shoul be 3.

For simple math expressions, you can use JScript.Net's Eval()
function. It may be easiest to write a small assembly in JScript.Net
that exposes a method that calls Eval(), and use that assembly in
your C# or VB.Net app.

Hope this helps.

Chris.
 
Back
Top