This tutorial introduces the Visual Studio IDE, and shows how to create a solution for a Windows application with a Windows form that says "Hello World".
To run this tutorial, you must have both Microsoft Visual Studio and Enterprise Developer installed.
To start Enterprise Developer:
The IDE is shown in the figure below, although the information displayed in the large pane will be different.
The large pane is where your solutions and projects will be opened. At the moment, this shows the Start Page, with up-to-date information on Visual Studio. When you start work, this is the pane where your code is displayed.
The pane at the bottom is the Output window, where messages from the IDE and Compiler are displayed.
The right-hand pane is the Solution Explorer, which displays the structure of your solution and projects. At the bottom of the Solution Explorer pane are some tabs. Solution Explorer appears by default.
If any of these panes is hidden, you can show it from the View menu.
The first task is to create a solution and a project. A solution is a container holding one or more projects that work together to create an application. The solution has the extension .sln and is a readable text file. Microsoft recommends that you do not edit the file outside of Visual Studio.
A COBOL project has the extension .cblproj and again is human readable but Microsoft recommends that you do not edit it. Different types of project have different extensions, so for example a C# project has the extension .csproj.
In this section, you create a project and solution, as follows:
The drop-down list above the center pane allows you to change the version of the target framework. Select the framework your clients are using to ensure your application includes classes and methods supported by it. You can leave the default .NET Framework for this demonstration.
Notice that the Name and Solution Name fields have the same name. Changing the name of the project automatically changes the name of the solution.
For example, if you create a folder on your c: drive called "Tutorials," change the location field to c:\tutorials. The solution will be stored in a subdirectory WinHello, according to the project name.
This creates a solution, a project and an empty form, which is opened in the form designer. The Solution Explorer pane shows the WinHello project, which contains:
If you need to view the contents of the project directory, you can open it from the IDE as follows:
This section "paints" a button and a label on the page or form.
Notice that the Name property of the button (in the Design section of the Properties pane) is, and remains, "button1."
The label essentially disappears upon this action, but remains on the form, as you will see when you build and run the application. Notice that the name property of the label control is, and remains, Label1 (or label1).
Now, you add an event handler to display "Hello World" when the button is clicked.