-
Equation
I know how to read user input using textbox but it only can read character and numbers. Is it possible that I want to read user input equation???
Example:
User type A+B
User put range of A and B.
1.25<A< 3.56
2.45<B< 9.87
I failed to read the equation using textbox. Is it there are other ways that can use to read equation input A+B???
I am using VS2005 and VB.Net. I really new in this programming using VB.Net.
-
Re: Equation
You'd have to parse the equation in such a way that you would know what the user could put in. I'm not really sure how that would work, but for the addition..you can just do an If statement to see if there's a "+", if so, split the text on the "+", and take the two numbers (that will come in a String Array), Double.TryParse() them, and then add them up.
-
Re: Equation
expressions evaluation is a three-staged process:
1. Parsing and tokenizing (splitting user input into parts called tokens)
2. Converting the expression from Infix into Postfix notation.
3. PostFix Evaluation.
I have my own expression evaluator which understands even some math and sting functions, supports 4 primitive data types including string. But I have abandoned it and didn't implement the support for variables and arrays.
If you're interested in some details - PM me.
-
Re: Equation