It is a code file automatically generated by your designer to hold the form's layout information that was created using the Visual Studio IDE. Previous versions of Visual Studio stored all of the information contained in the .designer.cs file in the main code file but the split it out due to user feedback.
Basically it means the ".designer.cs" file is for setting up the form where you can drag buttons around, add panels, resize the form, etc. Whenever you make a change visually with the development environment the changes are stored in .designer.cs.
Also notice the concept of a partial class. The X.cs and X.designer.cs files form the same class but are marked partial so they can be stored separately. You should in general not change the contents of the .designer.cs file, the IDE does that for you.
I give it a look from times to see how things get done, in the case I want to code something manually myself.
If I where you I should never delete the designer file. Consider it as a file that must be there as long as you are developing.
Take this test: create a forms app, put a button(whatever) on the form give it a name open the designer file and look the code that is automatically generated for it. Now change some properties of the button (position size etc.) now go to the designer file again and see how the code is changed, without you having to do it.
Most of the time I use VS C# 2008 Express. Under the build menu you will find a Publish option. Use it and see what happens. Happy computing!
Thanks for the reply...Is there any use with this designer.cs file Visual Studio.What if i delete this file.
Also what are the files created/required when try to publish a program to executable .
Whatever designing you do ,for that code is generated in designer.cs file.Like you have a picturebox and a panel on your form then the code for these two components will be in generated in designer.cs file automatically as you drag them on your form.The code which is automatically generated for these is:
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.PictureBox pictureBox1;
And if you delete this file it will create no problem but all the coding (for varoius components of toolbox),you have to include in .cs file.......
And most of the coders do this only..........
They do not include designer.cs file,instead they code for all components of toolbox ..........
thank you for the reply
Is it "better" to programmatically create form objects at run time or is it better to use the IDE tool box to drag items onto the form?? For example I made a project that had 27 buttons. I decided to create all 27 of them at run time with a for loop instead of manually creating them with the toolbox and used one method to handle all the clicks. Is it better to dynamically create buttons or is it better practice to create form widgets with the tool box?
Please RunTimeError post your question again in a new thread!!!
Solved threads are not intended to continue with another subject.
The file which contains the layout information.