"Andrew Cranwell" <lo**********@hotmail.com> schrieb:
I wanted to know if it is possible to convert a string into a code
expression, like you can with JavaScript's 'Eval' statement.
For example,
If I have a string such as "Dim A As New RandomObj()", can I turn this
into
code in some way?
No, not really. What you request is a feature typically available in
interpreted (scripting) languages. VB.NET is typically a compiled language
and thus doesn't provide intrinsic support for dynamically evaluating code.
However, it's actually possible to execute code dynamically at runtime:
Build a Custom .NET "EVAL" Provider
<URL:http://www.eggheadcafe.com/articles/20030908.asp>
Runtime Compilation (A .NET eval statement)
<URL:http://www.codeproject.com/dotnet/evaluator.asp>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>