简体   繁体   中英

VB.NET. How to convert a textbox input or a string into an arithmetic formula?

I am trying to create a grading system where you can choose your own subject and components(recitation, quiz etc) and as well as customize the formula... I will be using ddl language to create the fields and tables in the database so all's well with that, however, I have a big problem with the formula... I do not know how I can convert the string formula (from the textbox or the database) containing "variable names" into a workable formula that the system will recognize.

short example.

I declare three integers a, b & c with corresponding values (a =1, b=2, c=3). then let the user input a formula in a textbox.

example: textbox1: a+c

then equate the results using b...

this is where the problem lies, the program reads it as plain string and does not recognize the variable DX

How will I do this?

Some libraries which can evaluate simple math expression strings in .NET are:

Hope I helped!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM