Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Module 1 Tutorial Introduction To VSC#

Uploaded by

humiss545
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Module 1 Tutorial Introduction To VSC#

Uploaded by

humiss545
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Module 1 – Getting Familiar with Visual Studio Environment

1. Creating a new project in Visual Studio.

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.

Figure 1. Visual Studio Start Page

Please click on “Create a new project.”


2. Choosing the project template

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.

Figure 2. Project templates


3. Configuring the new project

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.

Figure 3. New project configuration.

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.

(1) Solution Explorer


window

(2) Properties
window

(3) Designer
window

Figure 4. Visual Studio environment after creating a new project.

5. Auto hiding/showing windows

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

Figure 5. Using pushpin buttons to minimize windows.

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.

Tabs to open the


windows.

Figure 6. The view with windows minimized using pushpin icons.


6. Standard Toolbar

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.

Navigate Open Save Solution


forward file all Redo Platform

Navigate New Save Undo Solution Run the Find in files


backward project Configuration project

Detailed description about toolbar buttons is provided in Table 1 below:

Table 1. Toolbar buttons


TOOLBAR BUTTON DESCRIPTION
Navigate backward Navigates to the previously active tab
Navigate forward Navigates to the next active tab
New project Creates a new project
Open file Opens an existing file
Save Saves the file that is currently open
Save all Saves all files opened in all tabs
Redo Redoes the latest operation that was undone
Undo Undoes the latest operation (i.e., change in the code or in the designer)
Solution Configuration Configures your project’s executable code
Solution Platform Lets you select the platform on which the application will run
Run the project Helps you run (and debug) your project
Find in files Searches for text in your application code
7. The Toolbox

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.

Click this tab to


display Toolbox.

Figure 7. Toolbox tab.

Click the pushpin to fix the Toolbox


window on the left-hand side.

Figure 8. The Toolbox Window.

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).

Figure 9. Closing a solution.

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.

Figure 10. Popup window to choose the next action.

You might also like