We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


dynamic loaded dll question

ingprokop asked
Medium Priority
Last Modified: 2012-05-07
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 :)

Watch Question


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


yes, that's what I'm looking for. I want to load them one after another form a folder and then just create and hide instances of the forms they contain. I never worked with a dictionary. So I can put the whole object into a dictionary like using an array?
Unlock this solution and get a sample of our free trial.
(No credit card required)


aha, that means I load all the dlls from the folder, will store them one by one into the dictionary and then, when needed create an instance of the assembly from which I create an instance of the contained form...

will check it right now...

thanks a lot
Yep thats right but you can create the instances all at once and store the instances in the dictionary if you like.


so I can create the instances of the forms from the assemblies and store them into the dictionary, I actually don't need the assemblies anymore. will try that, great


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.


great, it works and is much faster... will test it with larger strings and we'll see. will let you know...


...actually I have to relink the events each time I open the form instance - is actually quite logic
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.