Professional Documents
Culture Documents
ENGINEERING FACULTY
FIFTH SEMESTER-A
TOPIC: Creation of a basic Windows Forms on the IDE Visual Studio 2019 by
MEMBERS:
ACADEMIC PERIOD
CONTENTS
TABLES. ....................................................................................................................... 3
FIGURES. ...................................................................................................................... 3
INTRODUCTION: ........................................................................................................ 4
1. CHAPTER I. ........................................................................................................ 4
1.1. OBJECTIVES. ............................................................................................. 4
1.1.1. GENERAL OBJETIVE: ........................................................................ 4
1.1.2. SPECIFIC OBJETIVES: ....................................................................... 4
2. CHAPTER II. ....................................................................................................... 4
2.1. VISUAL STUDIO INTERFACE .................................................................. 6
2.2. Create a new project....................................................................................... 9
2.3. Add tools to the form ................................................................................... 11
2.4. CREATION OF A PROGRAM ON WINDOWS FORM. .......................... 12
2.4.1. CREATE A PROJECT: ....................................................................... 12
2.4.2. CONFIGURE THE FORM.................................................................. 14
2.4.3. PUT THE CONTROLS ON THE FORM. .......................................... 16
2.4.4. PROGRAM BUTTONS. ..................................................................... 19
2.4.5. RUN THE PROGRAM........................................................................ 21
3. CHAPTER III. ................................................................................................... 21
3.1. CONCLUSIONS.......................................................................................... 21
3
TABLES.
Table 1: Properties of the other controls. ..................................................................... 18
FIGURES.
Figure 1: Principal Window of Visual Studio.............................................................. 12
Figure 2: Choose the Project. ....................................................................................... 13
Figure 3: Name and path of Project. ............................................................................ 14
Figure 4: Project. .......................................................................................................... 14
Figure 5: Change the size of form................................................................................ 15
Figure 6: Change the start position of the form. .......................................................... 15
Figure 7: Name of Form. ............................................................................................. 16
Figure 8: Drag the components to the form. ................................................................ 17
Figure 9: Control on the form. ..................................................................................... 17
Figure 10: Change the property “Name” of “button1”. ............................................... 18
Figure 11: Change the property “Text” of the “button1”. ........................................... 18
Figure 12: Change “ReadOnly” property. ................................................................... 19
Figure 13: Result. ......................................................................................................... 19
Figure 14: Code for summing two numbers. ............................................................... 20
Figure 15: Code for subtracting two numbers. ............................................................ 20
Figure 16: Code for multiplying two numbers. ........................................................... 20
Figure 17: Code for dividing two numbers. ................................................................. 20
Figure 18: Code for initialize the components. ............................................................ 21
Figure 19: The program is ready. ................................................................................. 21
4
INTRODUCTION:
In this document we try to explain the object-oriented programming, detailing what a
class is, what a class attribute is, what class methods are and finally what an object is.
Later we explained how to use the Visual Studio interface and the realization of a
program through the "Windows Forms" project.
1. CHAPTER I.
1.1. OBJECTIVES.
1.1.1. GENERAL OBJETIVE:
To create a basic Windows Forms on the IDE Visual Studio 2019 by using programing
language C#.
1.1.2. SPECIFIC OBJETIVES:
To know the basis of object-oriented programming and its characteristics
Describe the interface, the main tools and the most used properties
To explain the basic use of the project Windows Form for creation of programs.
2. CHAPTER II.
2.1. OBJECT-ORIENTED PROGRAMMING
It is a programming paradigm that uses objects and attributes to design
applications and computer programs.
It's a special way of programming, closer to how we would express things in
real life
Example:
We have a bicycle
5
Object. My bike
Attributes: they allow to express qualities of the object or characteristics that it
possesses
Color is black:
Speed is 0 Km:
Number of wheels is 2:
Methods: actions performed by the object
Move along
Shift gears
Brake
2.1.2. WHAT IS A CLASS?
It is the description of a set of objects; consists of methods and attributes
(data) that summarize common characteristics of the objects
When we program an object and define its characteristics and functionalities,
what we are really doing is programming a class.
2.1.3. Attributes
They are the characteristics of the objects. When we define a property we
usually specify its name and its type
2.1.4. Methods
Are those that describe the behavior of an object
2.1.5. Heritage.
It is a property that allows objects to be created from existing ones, obtaining
characteristics (methods and attributes) similar to those already existing.
Example:
Class: Bicycle
Attributes:
Color is black:
Speed is 0 Km:
No. of wheels is 2
6
Object 1: My Bicycle
Color is orange:
Speed is 0 Km:
No. of wheels is 2:
Object 2: Your Bike
Color is red:
Speed is 1 Km:
No. of wheels is 2:
1. Toolbox
The toolbox is an important element in the IDE, because that is where the controls that
we will use in our projects are. The toolbox contains more than 130 controls to use in
our programming tasks.
8
Figure 2: Toolbox
2. Menu bar
The menu bar is frequently used in the development of our applications, the
file menu contains important submenus.
For example if you open File menu you will find, open a project, create a
project, save, configuration, exit
In the Edit menu, the most important options are: Cut, Copy, Paste, and
Delete.
In the View menu you will find the option to see the code, the designer mode
and something important is that if a window is not displayed, for example the
toolbox, in the View menu we can enable
From the project menu and its items, you can add forms to your projects, using
"Add Windows Forms" and other elements you need. You can also here,
change the configuration of the projects
9
The debug menu is very important because it allows you to test the projects
you are developing and the changes that you are making.
In the Tools menu we find an important item that is useful to work with
databases (Connect with database) because it is useful to connect databases
with Visual Studio applications
In the window menu there is a very important element like Reset window
design that allows you to recover the integrated development environment to
its default configuration.
3. Homepage
On the homepage, we find the options to open a project, create a project, and show
recently created projects.
Figure 4: Homepage
3. Select c#, then select “Application of Windows Forms”, name for the project and
finally click on next.
Figure 7: Project
Figure 8: Tools
2. Properties
12
For example in the text option, we enter the text to show. We have options to
change text color and size
Our text
Write
Figure 9: Properties
3. Then you need to write in the search bar “Windows Form”, then select
“Application of Windows Forms” and finally click on next.
4. Now, you can give the project a name, in the example my project will be called
“MY_FIRST_PROJECT”, then you need to set where it will be saved and click
on create.
14
Figure 4: Project.
Visual Studio creates automatically a form, where you can put controls and set up the
program.
2.5.2. CONFIGURE THE FORM.
15
In properties panel look for the property “Text” and write here the name of the form, in
my example I will put it “CALCULATOR”.
For the other buttons, you need to repeat the same action and for text box, too.
In addition, we are going to put an extra button for cleaning the text boxes and we put
a component called “Label” for the titles of the text boxes.
This have to be the result.
Now select the “button1” again with the mouse and look for the property “Text” in the
panel and change to “+”.
Change these properties for the other controls like the next table show you.
Finally we are going to change the property of the “textbox3 (Result)” called
“ReadOnly” to true. This property avoids that the user can write in this text box.
For program the buttons of our Project, we are going to double click on them and we
write the codes that we detail below.
1. Addition.
2. Subtraction.
3. Multiplication.
4. Division.
5. Clean.
21
3. CHAPTER III.
3.1. CONCLUSIONS.
Object-oriented programming (OOP) is a programming paradigm based on the
concept of "objects"and code, a feature of objects is an object's procedures that
can access and often modify the data fields of the object.
Was explained the basis use of the project windows form for creation of
programs, where we created a calculator with two numbers, by using buttons
text box, label, “Name” property, “Text” property and some programing.
Visual studio offers great ease of use, has a simple interface very easy to use
and many tools that make the work easier. Was explained how to create a
project, the tools we can use in the project and how to change the properties.