Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to type for example
"2+3*(2^2)/2-1"
in a textbox
and store the result in a variable
to display it in a label

What I have tried:

i want to type for example
"2+3*(2^2)/2-1"
in a textbox
and store the result in a variable
to display it in a label
Posted
Updated 30-Apr-18 1:21am

You will need to evaluate the expression.
You could write a parser, and an evaluator, or ... have a look at these:
An expression evaluator written in VB.NET[^]
The expression evaluator revisited (Eval function in 100% managed .NET)[^]
A Math Expression Evaluator[^]
 
Share this answer
 
Check this: A Calculation Engine for .NET[^]. This is excellent, very fast calculation engine!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900