eval function in vb.net?

T

Tony

Does anyone know how I can do an "eval" on a string?
I have a string back from a database equivalent to "5*6" how can I eval
this to an int type of value 30?
Taking this further, to evaluate custom vb functions ie
eval("5 * AvgPrice('partnum')")

I know about the databind eval function but I am not doing this where I
can use a databinder object

Thanks

Tony
 
?

=?ISO-8859-1?Q?=22Anders_Nor=E5s_=5BMCAD=5D=22?=

Tony said:
Does anyone know how I can do an "eval" on a string?
I have a string back from a database equivalent to "5*6" how can I eval
this to an int type of value 30?
Taking this further, to evaluate custom vb functions ie
eval("5 * AvgPrice('partnum')")

You can use Reflection.Emit to dynamically generate and execute code on
the fly. See
http://msdn.microsoft.com/library/d...flectionemitilgeneratorclassemitcalltopic.asp
for an example.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top