473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Evaluate string

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.
Jul 19 '05 #1
2 3698
"J. van Herten" <kj*********@hjklfio8uaysdf.nhakjsh> wrote in
news:eY**************@tk2msftngp13.phx.gbl:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Jul 19 '05 #2
See
http://groups.google.com/groups?selm...TNGP09.phx.gbl

"J. van Herten" <kj*********@hjklfio8uaysdf.nhakjsh> wrote in message
news:##**************@TK2MSFTNGP11.phx.gbl...
Is it possible to use the VB language instead of the J#??

"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"J. van Herten" <kj*********@hjklfio8uaysdf.nhakjsh> wrote in
news:eY**************@tk2msftngp13.phx.gbl:
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.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/



--
MikeB
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Laub | last post by:
I have no problems running the following dynamic XPath evaluator form MSXSL: <msxsl:script implements-prefix="dyn" language="jscript"> evaluate(context, expression) { return...
3
by: Coco | last post by:
Hi! Does c# has any class method that will be able to evaluate a given string e.g ((True && False) || (True && True)) and return the result in boolean for this case is true Thanks!
13
by: Zeng | last post by:
Hello, Please help!!! I've been stuck on this issue for months. I just wonder if there is a way to programmatically evaluate expression strings such as ( ( 3 + 5 ) / 2 ) > 4 --> this...
2
by: Brad Smith | last post by:
I'm trying to clean up strings in a web form before I plug the fields into a database. Lots of folks like to leave caps lock key on and yell their form entries. I can figure out how to change...
5
by: Csaba Gabor | last post by:
In Firefox 1.5 (this question is Mozilla specific as I am using greasemonkey) I would like to be able to use document.evaluate to return the first TD entry that shows ^\s*MySearchText\s*$. As I...
15
by: Phlip | last post by:
Javascripters: I have an outer page and an inner iframe. The outer page calculates some javascript, and wants the inner frame to run it. The inner frame should hit a page on the same (private)...
1
by: mat14 | last post by:
Hi, Is it possible to evaluate a string to get a logical output? For Eg. var string1 = "true && false || true" Is there any method that i can use to evaluate this string and get an logical...
2
kadghar
by: kadghar | last post by:
Many people asks if there is a way to write a mathematical expression, writen as a string in a text box, so they can do something like: sub something_click() textbox2.text=eval(textbox1.text)...
2
by: yarborg | last post by:
This is kind of a weird one and hard to find answers online because of the format of the question. Essentially I want to be able to have a string that looks like this "True AND True AND True" and...
1
by: aitia | last post by:
this the code. i used ECLIPSE to run this.. it has some codes smells that i can't seem to figure out.. can any one help? import java.io.*; import java.util.*; public class Postfix { private...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.