Evaluate string

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.
 
C

Chris R. Timmons

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top