You can load them all at the beginning and having many open shouldn't be a problem - there must be a bug in your code somehwere.
You can load them all and put them in a collection - eg a Dictionary
hi all,
each time I'm loading a new dll (containing a winform) dynamically to my main app, the previously loaded one (if there was one) isn't unloaded. the dlls are loaded dynamically when I select a button and their winforms are automatically shown. when I select another button, there is another dll loaded and another winform shown, the last should be closed. when I do this several times, the application freezes.
why is this? should I somehow unload the dll before loading a new one?
hope I was clear enough :)
thanks
d.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Yes a dictionary is a collection of things.
Each thing in the dictionary consists of 2 objects. One object would be something you use to lookup the thing - eg a dll name and the other object would be an instance of your dll.
Remember the very first code I showed you for this topic - that did it this way - see attached code again.
Noe that the Dictionary needs you to specify what type of objects you will use. String fro your first one and use the common interface for the second one as all of your dlls will be of that interface type.
Also see:
http://www.vcskicks.co
before, each time a button was clicked, an assembly was loaded and the interface event was "linked to it". I can now "link" (what is the correct word for it ... ) all of the interfaces for all the forms in the dictionary on the main form load, right? then, when sending the refresh event I just choose what form in the dictionary to send it to.
I had the problem that when sending the refresh event, the data was sent to all of the instances of the forms - that was sometimes quite slow because of large strings and the program just hung up.
Business Accounts
Answer for Membership
by: ingprokopPosted on 2009-07-04 at 11:05:46ID: 24777530
would be nice if there was a possibility to load all the dlls with the winforms at the beginning and then just use the instances of the forms instead of loading the dlls with the forms each time I press that button...