I’m working on a school project which need to be done in Visual Basic. For this I’m porting one of my Python project in this programming language, project which (in Python) is scanning a directory for .py files and then imports them (dynamically) with the __import__ statement, at runtime. It is possible to do this in Visual Basic with .DLL classes?
Thank you
You can load assemblies dynamically using
Assembly.LoadFrom(fileName)and then get the assembly information, enumerate the types, create instance of those types, etc. The details depend on what exactly you want this DLLs for.When you have the Type for the object you want to create, you can use code similar to this that uses
Activator.CreateInstance()method.You can find some (C#) samples in one of my projects: http://code.earlsoft.co.uk/hg/builderpro/file/41046067e90e/Library/Extensions/Extension.cs
http://code.earlsoft.co.uk/hg/builderpro/file/41046067e90e/Library/ActionInfo/ActionInfo.cs