Re: Trying to execute something stored in variable



Mike,

Are you person 1001 who tries to make a kind of Office Access Solution, you
change to succeed is probably the same as if you try to make a new
professional Texteditor?

It leads probably to nothing, however have a search in this newsgroup for
all those late binding solutinons using reflection.

Just my idea, maybe it does not help, or in the other hand maybe a lot
saving you a lot of time.

Cor


"Mike TI" <sunsetaaa@xxxxxxxxxxx> schreef in bericht
news:%237CRcQeZGHA.4248@xxxxxxxxxxxxxxxxxxxxxxx
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




.