Question size of the final .exe?

nokia123

Active member
Joined
May 1, 2011
Messages
29
Programming Experience
Beginner
The program I am making contains many Form ,and I see that adding Forms increase the size of the final .exe .
Is there any way to avoid it or Kindly suggest me some way to avoid making the large .exe ,as I have came to know that Large .exe is not good and also consume more RAM memory.

Regards,
 
I believe this is an unavoidable thing assuming that every form is needed. To shrink the .exe you need less code. There is a lot of code behind each form you add in .NET. Also, in the actual code you could consider re-writing things to become more efficient.

All-in-all less code = smaller .exe . So you should go through each form and see if there is a way to consolidate your forms and also go through your code to see where you can make improvements.
 
Thank you for your quick reply. I see that generally the .exe of the most of the software is small though the Software posses many graphics and other functionality .
 
The RAM usage would then be dependent on those references then which are most likely made to external code in a Dynamic Link Library (.DLL). But your descriptions are a bit vague more information may help.
 
Can I make Forms as .dll or ocx so that when they are needed ,they can be pulled using link to them?
PS : Don't be surprise if it sounds too novice :):) as i am a Newbie
 
Yes create two projects (Under one solution for easier management) -
Project 1 - Create forms you want to compile to exe
Project 2 - Create forms you want to go to dll

Set project 2 to Application Type: Class Library in project settings.
Compile...Then add reference in project 1 to project 2.

You can now use whatever is in the DLL in the exe now. Hope that helps.
 
I appreciate your comments. I think i have to learn Class Library and DLL making and Linking .Any good book name ,could you provide please.
 
Right off the top I am not sure about a book name, But the concept of a dll is pretty simple and I use them all the time. I have code that I reuse throughout a lot of apps I write sometimes. What I do is I create a project and say compile to a Class Library. I then write my code and compile. The result is a .dll file. This cannot be run like an executable but you can add a reference (Project --> Add Reference) to this file and now you can reference the objects in the Class Library.
 
Back
Top