Using Reflection
-
Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez
-
Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez
Assuming your "dll" is really a .Net Assembly it is entirely possible with Reflection. Just take a look at the
System.Reflection
namespace. You can load an assembly and call methods or create objects or whatever on the assembly. It isn't for the faint of heart because it involves some advanced topic but what you want is entirely doable in all version of the .Net. -
Hello! I want to "read" a dll file and get all its components, once that i do this i want to load the components into a ComboBox or ListBox, later i can select one of them and insert it into a windows form at run time. I think that maybe i can do this using Reflection but i don't know exactly how. Somebody knows how can i do somethig like this? Regards, Alberto Martinez
It's rather simple to get the types contained in a DLL. I'm writing an article on this and hope to post it by this month end. Here's the relevant code. Does this help? :)
string secondPlayerPath = secondPlayerTextBox.Text;
a = Assembly.LoadFile(secondPlayerPath); //TODO: Exception handling here
types = a.GetTypes();If you want, I can tell you when my article goes up. Cheers, Vikram.
I don't know and you don't either. Militant Agnostic
-
It's rather simple to get the types contained in a DLL. I'm writing an article on this and hope to post it by this month end. Here's the relevant code. Does this help? :)
string secondPlayerPath = secondPlayerTextBox.Text;
a = Assembly.LoadFile(secondPlayerPath); //TODO: Exception handling here
types = a.GetTypes();If you want, I can tell you when my article goes up. Cheers, Vikram.
I don't know and you don't either. Militant Agnostic
Hello!! Yes, i would like to know when your article is ready, thanks! Regards, ALberto Martinez