Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Execution of string variable containing form name
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00790231
Message ID:
00841713
Views:
35
Dave,

>What makes rick's code difficult is that he is dynamically compiling code on the fly. If the code is already compiled somewhere on disk, the process is relatively easy.<

Yeah, ok, but I don't think that the discussion was about pre-compiled code. < s >

~~Bonnie


>
>//1. Get a reference to the assembly where the class lives
>Assembly asm = Assembly.GetExecutingAssembly();
>//2. Instantiate the class
>Form f = (Form)asm.CreateInstance("Reflection.Form1");
>//3. Execute it
>Application.Run(f);
>
>
>>Dan,
>>
>>>>I gotta reread that when I'm sober. What a mind-job. There has got to be a simpler way!<
>>
>>Let us all know if you find one!! =)
>>
>>~~Bonnie
>>
>>
>>>>Bob,
>>>>
>>>>It can be done, although it's not trivial as it was in VFP. See Rick's article on the subject at http://www.west-wind.com/presentations/DynamicCode/DynamicCode.htm
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>
>>>Jeebus.
>>>
>>>I gotta reread that when I'm sober. What a mind-job. There has got to be a simpler way!
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform