Displaying a form from a dynamically loaded DLL

后端 未结 4 649
情深已故
情深已故 2020-12-29 11:14

This is an extension of a question I previously asked here.

Long story short, I dynamically load a DLL and make a type out of it with the following code:

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 11:45

    You have to do something with the form you've just created:

    Assembly assembly = Assembly.LoadFile("C:\\test.dll");
    Type type = assembly.GetType("test.dllTest");
    Form form = (Form)Activator.CreateInstance(type);
    form.ShowDialog(); // Or Application.Run(form)
    

提交回复
热议问题