Mike TI said:
Nov 14, 2007
Hi
I have checked links, still apparently they do not answer my
question.
I want to build an expression from within the program and then store
it in a variable like
mVariable="A1+A2+A3"
Now I want to put the result of the above into another variable like
mTotal=Eval(mVariable)
The applications should return the value as if I had entered
mTotal=A1+A2+A3
Thank you.
"A1+A2+A3" is an expression. An expression has a syntax. If you need VB.net
syntax, you need a VB.Net compiler. The compiler compiles to IL code, and
the JIT compiler will compile it to native code when executed.
An executable statement in VB.Net must be part of a procedure/method. A
method is part of a class. The class must belong to a project. You don't
have a project.
So, in order to execute a line you must
1. create a project
2. add a class
3. add a procedure
4. add an executable line
5. compiler the project
6. run the executable
Alternatively, have a look at the System.Reflection.Emit namespace. There
you will also have to create an assembly, a class, a method and executable
code.
What you want to do is not possible because you don't give the line an
environment to live in.
Armin