Let the user write a line code
-
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".) How can i do it?
-
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".) How can i do it?
Have a look at Inside the Mathematical Expressions Evaluator[^].
bonzaiholding wrote:
I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".)
You can search the input string for the variables ("x1", "x2", ...) and replace them with their corresponding values from your properties. After that, you can pass the string to the Mathematical Expressions Evaluator and get the result. :)
Nuri Ismail
-
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".) How can i do it?
-
Have a look at Inside the Mathematical Expressions Evaluator[^].
bonzaiholding wrote:
I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".)
You can search the input string for the variables ("x1", "x2", ...) and replace them with their corresponding values from your properties. After that, you can pass the string to the Mathematical Expressions Evaluator and get the result. :)
Nuri Ismail
Thanks for all of your answers.
-
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".) How can i do it?
Sigh, I remember having to do this at uni....RPN anyone? Seriously though look up Reverse Polish Notation and stacks. It might help...it might not :) I am not very helpful am I? I just went on a nostalgia trip is all because of your post! :) thank you :) Cads
-
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time. (Lets say that i have properties that called "x1", "x2" and "x3".) How can i do it?