Trying to execute something stored in variable



April 22, 2006

Hi all

I want to execute a command stored in a variable, eg I may store:

Form1.Show()
or
Form2.Show()

in the variable and then execute whatever is in the variable.

I read about the System.CodeDom namespace in MSDN, however I am unable to
get the example given to work. Does this do what I have in mind ?

*****
Dim start As New CodeEntryPointMethod()
Dim cs1 As New CodeMethodInvokeExpression( _
New CodeTypeReferenceExpression("System.Console"), _
"WriteLine", _
New CodePrimitiveExpression("Hello World!") )
start.Statements.Add(cs1)
*****

Please assist


.



Relevant Pages

  • Re: Best way to store postfix data?
    ... with control logic in the same time as the old read one line, execute ... but there's some memory hog I've missed in there. ... that seems infinitely preferable to trying to store them inline ... Since I allow control routines, I have to execute at runtime, ...
    (microsoft.public.vc.mfc)
  • Re: is malloc thread-safe??
    ... Richard Tobin wrote: ... If two separate threads that share the variable both execute the ... it can do the "store", the second thread can load, add, and store, ... C on some systems), an implementation-dependent locking mechanism ...
    (comp.lang.c)
  • Re: Concurrencty violation with decimal type
    ... > The Update statement is generated by the CommandBuilder. ... > statement fails in code and gives the concurrency violation error. ... I think today I will try to just store it ... When I try to execute the update statement directly in the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: extract values from a csv file
    ... The reason I asked to store the values into ... individual variables, because I need to execute another shell script ... line by line and store the values into variables and then execute the ...
    (comp.unix.shell)
  • Re: Concurrencty violation with decimal type
    ... The Update statement is generated by the CommandBuilder. ... I then login via TOAD and execute the statement. ... I have changed the variables I store CRRNT_ARFRM_HRS from decimal to double, ... when a decimal type field changes from ...
    (microsoft.public.dotnet.framework.adonet)

Loading