7
Answers

How Do I: Run a Dynamic Class?

Gustavo

Gustavo

14y
2.2k
1

Hello:
 
This is part 2 of an issue.
 
Initially I wanted to take a TextBox value and run that class. The following code is what I have been tolod to do. It took a while to get it to compile. However, now I need to know how to run/execute the class.
TheClass = textBoxClass.Text;
Assembly TheAssembly;
TheAssembly =
Assembly.GetExecutingAssembly();
object MyDynamicClass = TheAssembly.CreateInstance("ICEPack.Class" + TheClass);
MyDynamicClass();   //<<<ERROR - How do I run the class MyDynamicClass?
Answers (7)