Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

 

sFile = "LocalManagement.DLL"

oAssembly = System.Reflection.Assembly.LoadFrom(sFile)

Posted

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...)

Posted

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?

  • *Gurus*
Posted

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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...