DLL Forms

ross246

Member
Joined
Oct 19, 2010
Messages
6
Programming Experience
Beginner
Hi there,

Hope this is the correct place to post this.

I currently have a rather large project that is all contained in one Windows Application or rather executable. It consists of buttons on the main form (workspace) that when clicked opens other forms or classes that are relatively self contained in terms of how they work.

I am now looking at publishing this project so I want an easy way to create updates for my software. The best way I could think to do this was to create each form in a self contained dll and then when a user presses a button from the main form, the dll is loaded and processing within this dll can be performed. I managed to create the dll and link it with the main form, it is all displayed correctly. Doing it this way will allow me t omake slight changes to only a single DLL and this DLL could be downloaded very quickly.

The only problem I am having is that I used my.settings to save specific application settings that are shared between the different forms (now dlls).

I just need some advice on whether creating dlls for each "module" is the correct way to go about this, and if so, how would I share SAVED variables that need to remain even after the application gets closed and re-opened?
 
I would recommend against creating a separate DLL for each form. Larger chunks of related functionality, maybe, but not each and every form. If you want to pass settings around several assemblies then define a class that represents the settings in its own assembly and then reference that in all the others. The application can then create an instance of that class and pass it to the library assemblies.
 
Thanks jmcilhinney for the reply.

I will use a separate DLL so I can access the settings, I need to store some reasonably sensitive data so I guess I can encrypt each line then decrypt it again when accessing it? would it be better to create a class that handles a text based file called lets say profile.dat and encrypt the data within that?

Why would you recommend against creating a separate dll for each form? Is this considered bad practice or is there a performance/resource issue involved?

The forms that I would create into dlls would be rarely used, all the main processing takes place within the main form which belongs within the application. I just thought it would be easier to update a 35kb dll (change buttons labels code) than to replace a 35mb executeable.

Thanks again for the reply :)
 
You definitely should not have a 35 MB EXE but creating multiple DLLs for just a form would not be considered good design. As I said earlier, breaking the functionality of your application into logical groups and creating separate assemblies for each is a fine and, given the size of your EXE, sounds like something you should do. The lines should not be drawn around individual forms though.
 
Ok thanks again jmcilhinney,

I guess it's time to revise my plan and do some research on where these "lines" should be drawn in order to reduce the size of my exe :)
 
Back
Top