Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

solving math equations stored in strings 1

Status
Not open for further replies.

FerretRunner2

Programmer
Apr 18, 2005
2
0
0
US
The question is whether it is possible for an equation stored in a string (that is written as an arithmetic operation that Visual Basic would accept) to be solved in Visual Basic. Specifically, whether a variable could be entered into the function (like if X represented where the variable should be used).

I have heard the question before, and have wanted to use it myself but until now have simply found a way around it. I would like to make a program that involves graphing several things, and being able to simplify an equation from a string that depends on a variable would quite useful. I would like to avoid performing string operations to separate it into parts, although, because that would be tedious and if that is the only solution, I will try finding a way around this.

Thanks for any help in advance.
 
Try adding a reference to the VBA library to your project. You should be able to pass your string to it, to be interpreted.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Eval may fit your needs.

Note: You must have Project reference to MS Access Library.
 
Thanks for the help, I got it working. I'm surprised it was that easy! (I used MS Access and Eval). Thanks also chiph, I just found that the MS Access was the easiest for me to figure out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top