Building Windows Applications in C# Visual Studio

I am a college student who is new to building application is Visual Studio. I currently have opened a new windows application project in Visual Studio 2005 and has the bare skeleton structure.

This is what I want to do:

1) Create a class diagram. Automatically generate the code based on the class diagram. I already have the class diagram built in Microsoft Visio 2003. If there is a way to import that into Visual Studio 2005, that would be nice too.

2) Write the necessary code in the main() and in the necessary classes generated by the class diagram.

3) Successfully compile ("Build") and run the program.

My Questions:

1) Strategy of how I should accomplish the above with respect to the empty skeleton structure of the code that currently exists.

2)  An brief explanation of what I should know about the following in the skeleton structure of "Program.cs" main method() i.e.:-
        static void Main()
            Application.Run(new Form1());


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.



I am not sure about the compatibility of VS2003 to VS2005 but try to add the existing class diagram to VS2005.  Right click on the project and select add|new item and choose a class diagram from the resulting dialog.  If this doesn't work then create the diagram in VS2005.  The code automatically generated as you add classes, methods, properties etc.

Write whatever your necessary code is.  This is a windows application so a form class will have to be instatiated in the main.  Your app starts when that form is displayed.  You then put controls (buttons, labels etc).  For example you can create a click event for one of the buttons you put on the form, then in that click event you can use your other classes to perform a task (display some info, read a file etc)


The above line is to do with how controls are displayed.  This line has no effect on your code, it is for WinXP and later special visual rendering of controls

(From MSDN)
This method enables visual styles for the application. Controls will draw with visual styles if the control and the operating system support it. To have an effect, EnableVisualStyles must be called before creating any controls in the application; typically, EnableVisualStyles is the first line in the Main function. A separate manifest is not required to enable visual styles when calling EnableVisualStyles.


(From MSDN blogs)
Certain Windows Forms controls can render their text using either the GDI graphics library, or the newer GDI+ library. This change was made because of performance and localization issues with GDI+. By default, existing controls that support the UseCompatibleTextRendering property are set to true for backwards compatibility, but all new controls in environments such as Visual Studio have this property set to false. Use SetCompatibleTextRenderingDefault when you wish to switch the default text rendering for new controls.

You should never call this method if your Windows Forms code is hosted in another application, such as Internet Explorer. Only call this method in stand-alone Windows Forms applications.

No sample code, since the call is very simple. Just stick this in your Main() method before calling Application.Run(), and you're set.

Application.Run(new Form1());

This line starts your application loading a new instance of form1.  Form1 is your start point, you then access other forms/classes in your app from Form1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.