private void frmPluginTest_Load(object sender, EventArgs e) { Control oTP; string[] dllFilenames = Directory.GetFiles(@"P:\PJKPlugin\TabPages","TabPage*.dll",SearchOption.AllDirectories); foreach (string filename in dllFilenames) { try { Assembly asm = Assembly.LoadFrom(filename); Type[] typesInAssembly = asm.GetTypes(); foreach (Type type in typesInAssembly) { if (type.GetInterface("PJKPlugins.ICMSTabPage") != null) { ObjectHandle o = Activator.CreateInstanceFrom(filename,type.FullName); oTP = (Control)o.Unwrap(); this.PluginTabControl.Controls.Add(oTP); } } } catch(Exception ex) { Debug.WriteLine(ex.Message); } } }