C#. Windows Forms type Application Development in MS Visual Studio 2010

Windows Forms type Application Development in MS Visual Studio 2010


Contents


Search other websites:

Instructions

1. Run the Microsoft Visual Studio 2010

 

2. Command of creating a new project

Select the command

File->New->Project

Visual Studio Creating project Command "New-Project..."

Figure 1. Creating a project

 

3. The “New Project” window

Select the next elements in Window that appeared:

  • in the “Installed Templates” field select “Visual C#”;
  • in the middle window choose Windows Forms Application;
  • in the field “Name” set the name of application (by default WindowsFormsApplication1);
  • in the field “Solution Name” set the name of Solution File (by default WindowsFormsApplication1).


We confirm our choice by pressing the “OK” button.

Visual Studio window select type applicationFig. 2. The window of selecting type of created application

 

4. Main form of application

In the previous window, after select Ok, MS Visual Studio will generate a programming code of project, and then window with future program’s form will appear on the screen (fig 3).

C# Visual Studio window main application

Fig 3. The window of main application form in design mode

 

5. Run the application

After that you can make the development of our application, place on it different components, describe own variables or methods, and bind some parts of the programming code between them, etc (fig. 4).

Visual Studio command "Start Debugging"Fig. 4. Running the application through menu item

Compiler previously checks the program text for errors. If there are no errors, then loads the program for execution. Figure 5 demonstrates the window application after loading. As seen, it is an empty form, which can respond to commands from the system menu – minimize, maximize, close (Alt + F4). The program also responds to pressing “Alt + space” through which caused the system menu.

Visual Studio execution Windows Forms ApplicationFig. 5. The program execution of Windows Forms Application type

If the text of the program has a syntax errors, the bottom of the screen in the “Error List” window displays information about the error.

Visual Studio Window "Error_List"

Fig. 6. Window panel “Error_List” with the error information

 

6. Files list that are created in Microsoft Visual Studio 2010

After creating an application, system MS Visual Studio generates several files that appears in the Solution Explorer (Fig. 7).

Visual Studio Window Solution Explorer list files

Рис. 7. Window of Solution Explorer with a list of created files

The most important files in this list have the following functions:

  • Program.cs – file is a main entry point to the application. Contains the function Main()
  • Form1.cs – file corresponding to the main form of the program. The system has the ability to view the code of the main form of the program and its visual image. In this file, you can add your own variables (fields) and methods
  • Form1.Designer.cs – file containing a class that describes the elements of the form generated by the system
  • Form1.resx – file containing a list of resources that are connected to the main application form (strings, images, icons, text files)
  • AssemblyInfo.cs – contains information about the assembly

 


Related topics