>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
ubject: 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 co
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
?url=/library/en-us/dnadvnet/ht
ml/vbnet10082002.asp
-Original Message-
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Rothlander
Sent: Wednesday, February 15, 2006 11:49 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Dynamically
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/
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] SupressConte
12 matches
Mail list logo