Module 1 Tutorial Introduction To VSC#
Module 1 Tutorial Introduction To VSC#
Please run Visual Studio 2019 (Community Edition) in your computer. First you should see the Start page
as shown in Figure 1. On the left-hand side of this page are listed the recent project you have been working
on. But, if this is the first time that you open Visual Studio to create a project, it will display nothing.
For now, we are more interested in the right-hand side of the page, where it says, “Get started”. There
are several options there, and among them we will choose the “Create a new project” item. You need to
create a new project in Visual Studio each time you want to develop a new Visual C# application.
The list of project templates will be displayed on the right-hand side (see Figure 2). There is a search option
and some other filtering options available to help you quickly find the template that you are interested
in.
Throughout this course we will focus on creating C# Windows Forms applications. To create a new
Windows Forms project, we need to click on Windows Forms App from the list shown.
Please note that, there are two Windows Forms items in the list. The first item is based on the C# language,
which we prefer, and the second item is based on the Visual Basic language. Ensure that you choose the
C# version of the Windows Forms App item.
In the next screens (Figure 3), you need to configure your project. To do that, please first simply enter a
project name (e.g., HelloVisualCSharp). Throughout this course, we will create many projects. It is a good
practice to always enter a descriptive project name instead of using the default text. Otherwise, I promise
you that in two weeks you will not remember what each project does.
Solution name will be automatically the same as the project name you type. Solution is a container that
can hold multiple projects. Throughout this course, we will always keep the solution name the same as
the project name.
In the next window, please choose .NET Core version for the target framework and then click Create.
4. Visual Studio environment
Visual Studio environment with newly created project should appear after a several seconds, as you can
see in Figure 4 below. This environment is composed of several useful windows and some menu items.
There are three windows that you will mostly use. First one is the (1) Solution Explorer. In this window,
you can access the projects in your solution and navigate through all project files.
Second one is the (2) Properties window, where you can view and change the properties of any element
selected, which can be a label component that you may add to the form, or a file chosen in the Solution
Explorer.
The third window is (3) Designer window, which allows you to build the graphical user interface (GUI) for
your application.
(2) Properties
window
(3) Designer
window
Many windows in Visual Studio can be minimized to a tab using the Auto Hide feature. This feature can
be turned on/off by clicking on the pushpin icon in a window’s title bar. To minimize the Solution Explorer
and Properties windows, please click on the pushpin icons as shown in the image shown below.
Pushpin icons
You should obtain the following view, where the tabs for Solution Explorer and Properties are shown on
the right hand-side vertically. You can click on these tabs to display the windows.
Standard toolbar gives you a quick access to some frequent commands that you will need quite often such
as save, debug, etc. The following figure labels the functionality of each button in the toolbar.
When creating the interfaces for your applications, you need to use various form controls such as labels
(to display some text), buttons (to enable some user actions), textboxes (to receive user input) and so
forth. These controls are accessible from the Toolbox located (mostly) on the left hand-side of the Visual
Studio window. It might be initially minimized. To display the toolbox, please click on the Toolbox tab.
The controls in Toolbox are grouped by sections. As you may see in the image above, the controls that
you will use very frequently are placed in the Common Windows Forms sections. You can explore the
other sections in the Toolbox.
8. Closing and opening projects in Visual Studio
To close your project, you can simply close Visual Studio. However, if you want to switch to a different
project, you may prefer to exit from the current project. To do that, you should click on the File menu and
then click on Close Solution (Figure 9).
Then, a new window popup will showup asking you to what to do next. You can open a recent project
(from the list on the left side) or do any other operation listed on the right side.