Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help needed with Reflection
Message
 
To
25/08/2007 17:12:31
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01250136
Message ID:
01251381
Views:
24
Success with code below, thanks to all of you who contributed
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);
          }
     }
}
Regards,
Peter J. Kane



Pete
Previous
Reply
Map
View

Click here to load this message in the networking platform