look into System.Activator class, it has a bunch of CreateInstance methodsif you need to load the assembly first, look int  System.Reflection.Assembly class, it also has bunch of CreateInstance methods

解决方案 »

  1.   

    http://blog.csdn.net/shanyou/archive/2004/03/24/10083.aspx
      

  2.   

    给你参考一下吧using System.Reflection;
    Assembly formAsm=Assembly.LoadFrom("WindowsControlLibraryTest.dll");
    Type formType=formAsm.GetType("WindowsControlLibraryTest.UserControl1");
    object formObj=Activator.CreateInstance(formType);
    Form theForm=(Form)formObj;
    theForm.Show();
      

  3.   

    WindowsControlLibraryTest.dll   是什么东西
      

  4.   

    MYFORM myform=new MYFORM();
      

  5.   

    使用反射。试试Activator.CreateInstance方法。
      

  6.   

    我是这样的:
    Form obj;
    obj = (Form)System.Activator.CreateInstance(
    Type.GetType("System.Windows.Forms.Form,System.Windows.Forms"));
    obj.Name = "MYFORM";
    obj.Show();运行出错:
        值不能为空
        参数:Type
      

  7.   

    Type.GetType("System.Windows.Forms.Form,System.Windows.Forms"));
    应该为是你的类名
      

  8.   


    http://www.c-sharpcenter.com/CSNET/dynamicinvoke.asp
    http://www.c-sharpcorner.com/Code/2002/April/LoadingAssemblyInfo.asp
      

  9.   

    [STAThread]
    static void Main(string[] args)
    {
    String sTypeName = "a.ClassA";
    String sPath = "C:/"; //System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom("a.dll");
    System.Reflection.Assembly asm = System.Reflection.Assembly.Load("a");
    Object o = asm.CreateInstance(sTypeName, false, BindingFlags.CreateInstance, null, new Object[] {sPath}, System.Globalization.CultureInfo.CurrentCulture, null); Console.WriteLine(o.ToString()); Console.ReadLine();
    }
      

  10.   

    Activator.CreateInstance方法。自己查查MSDN就知道了!