>public static T CreateObjectFromString(string typeName, Type[]
> types, string[] paramValues)
Why not the more generic object[] for paramValues?
> parameters[i] = Convert.ChangeType(paramValues[i],
You could use something like the ChangeType helper from
WilsonORMapper's QueryHelper to
I wrote a class that is basically a wrapper for creating dynamic objects
based on their assembly and type name (as string). I use:
Type.GetType(TypeNameAndAssemblyString).GetContructor(ParamTypes[]).Invo
ke(ParamValueObjects[]);
I have that wrapped in a generic method that:
return T returnObj
> Thanks for responding, but I need to soft code the form names because I do
> not know what are called at design time.
>
When I read your question, AppDomain.CreateInstanceAndUnwrap did cross
my mind, but I skipped it as soon as I read you had done similar stuff
in VB6 several years ago... ;)
Ca
Check-out the Activator.CreateInstance methods and
AppDomain.CreateInstanceAndUnwrap()
I find AppDomain.CreateInstanceAndUnwrap() to be a bit more useful.
If your class will be in the same assembly and namespace then you can do
something like:
Dim o As Form = CType(AppDomain.CurrentDomain.CreateI
Heh. Beat me to it.
dg
-Original Message-
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Dean Cleaver
Sent: Wednesday, February 15, 2006 4:58 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
You
ded.
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: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
Maybe I did not under
al Message-
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ryan Heath
Sent: Wednesday, February 15, 2006 2:18 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
Maybe I did not understand your question but cant y
advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ryan Heath
Sent: Wednesday, February 15, 2006 2:18 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Dynamically Displaying WinForms.
Maybe I did not understand your question but cant you do something like
Dim frm
This is done through reflection which gives you the ability to use strings
to reference classes, assemblies etc.
Check out this article by Billy Hollis that does just what (I think) you are
after, right down to the list of forms being in an xml file.
http://msdn.microsoft.com/library/default.asp?
I think you can use the System.Reflection.
You can associate each form name with the name of the dll, in the XML file,
and then load the dll using System.Reflection and create instances of the form
with the form name from the XML.
I can see this happening but, i am not sure if this is what
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/
11 matches
Mail list logo