eval function in vb.net?

  • Thread starter Thread starter Tony
  • Start date Start date
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
 
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

Back
Top