I have created a DLL that contains several forms. At run time I need to get all form names and forms from this DLL.
How can I do it? I can get the assembly, but I am confused how to get individual objects from it.
I have implement it like this:
- Make a DLL
- Expose method like: Open form A / Open Form B
- If you need form interaction --> Open other forms from form A/B (in DLL code) and so on...(I mean form A/B is some start points...)
1. Thank you. Do I unsderstand correctly that I need this to load all forms?
dim ar as ArrayList
dim oTypes as System.Type
oTypes = oAssembly.GetTypes
for i=0 to ubound(oTypes)
ar.Add oAssembly.CreateInstance(oTypes(0).FullName)
Next
2. What is the good way to store a form display name? Type.Name gives me "frmData" and I need to display "Transaction Data". Of course, I can make it public property of a form but then I will have to load form in order to read it. Is there some property that I could use to store it so I can get display name without loading form?
3. How does it work memory-wise? Will DLL stay in memory after first accessed? How can I make sure that it does not? Can keeping 150 form in memory introduce memory problems?
1. Use Type.IsSubClassOf(GetType(Form)) to make sure first.
2. I would use an attribute to attach a text "friendly" description to each form, which you can retrieve with reflection without having to create an instance.
3. Let the GC worry about that.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.