Execute something stored in a variable

  • Thread starter Thread starter Mike TI
  • Start date Start date
M

Mike TI

April 20, 2006

Hi All

Thank you every one for your help, I have now started to get the feel of
VB.Net 2005.

How can I execute something stored in a variable.

For example, I want to store:

UserControl1.Show() or
UserControl2.Show()

in a variable and then execute whatever is in that variable.

Thanks in advance.
Mike TI
 
April 22, 2006

Thank you for your reply. I found the example very difficult to understand
as I am very new to VB.Net.

Incidently, 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
Mike Ti
 
Back
Top