You mean something like:
ObjectHandle oh =
Activator.CreateInstanceFrom(System.IO.Path.Combine(path, "Your.dll"),
"Your.Namespace." + formName,
true,
BindingFlags.Instance | BindingFlags.Public,
null,
new object[] {},
null,
null,
null);
Form form = (Form) oh.Unwrap();
?
Dino
-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Rothlander
Sent: Thursday, 16 February 2006 11:36
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
Ryan,
Thanks for responding, but I need to soft code the form names because I
do not know what are called at design time.
The code you have would not work becaue you have to hard code the Form1
name in the code. I need this soft coded.
Greg
-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ryan Heath
Sent: Wednesday, February 15, 2006 2:18 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
Maybe I did not understand your question but cant you do something like
Dim frm
Select Case clickMenu
Case "form1":
frm = new Form1
Case "form2":
frm = new Form2
Case "form3":
frm = new Form3
Case Else
Throw New NotSupportedException( clickMenu) End Select
frm.Show
HTH
// Ryan
On 2/15/06, Jon Rothlander <[EMAIL PROTECTED]> wrote:
> I should have changed the subject.... Sorry for the annoyance.
>
> -----Original Message-----
> From: Jon Rothlander [mailto:[EMAIL PROTECTED] On Behalf
> Of [EMAIL PROTECTED]
> Sent: Wednesday, February 15, 2006 10:47 AM
> To: 'Discussion of advanced .NET topics.'
> Subject: RE: [ADVANCED-DOTNET] SupressContent property on HttpResponse
>
>
> I have a need to display a form based on a the content of an XML file
> that is loaded into a menu control. Lets say that you have an XML
> that holds a list of menu items that represent different forms within
> the app. However, depending on the client and the authority of the
> user, I do not know which forms they will have access to. So what I
> need to do is to load the users list of forms via an XML file. At
> that point, I will fill a menu list with the controls. When the user
> selects an item from the menu, I want to load the form.
>
> I used to do this in VB6 and I cannot figure out how to do this in
.Net.
> It's been so long since I have needed this, that I cannot recall how
> this used to work in VB6 and I no longer have access to the VB6 code
> to see what I was doing back 7 years ago.
>
> It seems really simple, but I cannot figure out how to us a string
> with the form name, to be used to create the new instance of the form.
> Is there an easy way to do this?
>
> Something like....
>
> Menu
> Form1
> Form2
> Form3
>
> Button click for the menu items...
>
> Dim frm as new form("form1")
> frm.Show
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentorR http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com