G
Guy
im running some code to instantiate a form, based on the
name selected at runtime.
Im using System.Activator.CreateInstance to load a form
by its fully typed name, here is the code....
string fName = "frmToLoad";
Form myForm;
myForm = (Form)System.Activator.CreateInstance
(Type.GetType("HCS.SkillsRegister.Projects.UI." + fName));
this all works fine providing the form/type i am loading
is in the same assembly as the one this code piece is in
(the main executing assembly). I have an assembly that
uses the exact same namespace as the one the code
executes from(its a referenced dll), but yet i always get
a null reference exception when i try to load one of the
types from the referenced assembly. Even when i
instantiate an object from the referenced assembly first
(to preload the assembly) it still doesnt work.
The full type name is also correct
What am i missing here?
name selected at runtime.
Im using System.Activator.CreateInstance to load a form
by its fully typed name, here is the code....
string fName = "frmToLoad";
Form myForm;
myForm = (Form)System.Activator.CreateInstance
(Type.GetType("HCS.SkillsRegister.Projects.UI." + fName));
this all works fine providing the form/type i am loading
is in the same assembly as the one this code piece is in
(the main executing assembly). I have an assembly that
uses the exact same namespace as the one the code
executes from(its a referenced dll), but yet i always get
a null reference exception when i try to load one of the
types from the referenced assembly. Even when i
instantiate an object from the referenced assembly first
(to preload the assembly) it still doesnt work.
The full type name is also correct
What am i missing here?