Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to execute a formula stored in a string in VB?
Message
From
12/01/2001 09:47:56
 
 
To
12/01/2001 09:38:43
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00462910
Message ID:
00462918
Views:
14
>Hi VB Gurus (I hope),
>
>I want to create a function that can execute a formula that gets passed in as a parameter. In VFP, I can simply use the EVAL function or if necessary, the ill spoken macro substitution character.
>
>In VFP my code would look something like this:
>
>nValueA = 2
>nValueB = 3
>nValueC = 6
>cCalcString = "(nValueA + nValueB) * nValueC"
>
>nResult = EVAL(cCalcString) && nResult is 30
>
>How would I do this in VB? And please don't suggest that I hard-code the formula - there's about 100 of them and I don't think it makes sense to code 100 separate functions that all do basically the same thing.
>
>Thanks for your help!
>
>-JT

You can use the script control for that. See the following KB article: http://support.microsoft.com/support/kb/articles/Q184/7/40.ASP
Previous
Reply
Map
View

Click here to load this message in the networking platform