Sei sulla pagina 1di 39

Programming NCIII

Visual Basic
GRADE 12 F2F
CONTENT

 Introduction to Visual Basic


Introduction to Visual Basic
A brief history and background of
Visual Basic
 The Visual Basic programming language was developed by Alan Cooper, an
American computer scientist in the late 1980’s.
 This programming language was created with the main purpose of teaching
programmers and developers how to design and develop graphical-user
interface (GUI) programs easily.
 The reason behind GUI name is that we work more with graphics, forms and
icons than typing text to accomplish a particular task.
 In GUI approach, rather than trying to remember a hard to remember
command and its corresponding parameter, we can remember easier by using
pictures, objects and images.
What Visual Basic can do?
 We can develop:
- Computer games
- Information systems
- Multimedia powered application
- Front-end business application system for back-end database
servers such as SQL server or Oracle database server.
- Internet-enabled or Web-based application system
- Programs for hand-held devices
and so much more..
Different Versions of Visual
Basic.NET
 The first version of visual basic.NET was released in February 2002,
followed by the second release in March 2003. the Visual Basic 2005
was released in late 2005. Visual Basic 2008 follows in November
2007.
Different editions of Visual basic 2008:
 -VB 2008 Enterprise edition
 -Professional edition
 -Express edition
 -Team suite edition
 The Express edition is configured to be used by students,
developers, hobbyists and consultants for testing and
experimentation purposes. This means that you cannot use the
programs you develop in Express edition due to its inherent
limitation. You have to use the licensed edition (Standard,
Professional edition, or Team suite) when you plan to develop a
business application system that will be used by companies or
government agencies.
 Whatever you learn in Visual basic express edition is applicable to
the licensed edition.
Common elements of the Visual
Basic IDE
 TheIntegrated Development Environment (IDE) is
the workspace where we construct together all
the components of our application system such as
the place where we design our forms and controls
as well as the place where we develop our code
or programs.
 The Start Page - we can use the Start page to select from recent
projects. We can also select a New project from here, by clicking
the New Project icon at the Toolbar or as a menu item at the File
menu.
 Note: the recent projects are simply the list of recent projects that
we have designed and developed.

 The New Project dialog - when we create a new project, we


select this menu item from the File menu or alternatively, we can
click it from the Toolbar.
 The Menu bar – or the menu system is actually like the menus we
have seen in other Windows application software such as MS Word,
MS Excel and PowerPoint. This menu will give us access to many
features within the integrated development environment (IDE).
Some of the menu items that we can see at the menu bar are File,
Edit, View, Tools and more.
 In File menu, we will work with the actual files that make our
application system
 In Edit menu, we can perform the standard clipboard options such
as cut, copy and paste.
 Toolbars – below the menu bar are list of icons which are called
toolbars. They provide us a quick access to commonly used menu
items(as an alternate way to search for a command), we simply
click an icon(which is an equivalent to the menu-bar command)

 Toolbox – contains the tools or objects(controls) that we might


want to place (drag and drop) on a Form control in our application
system on which we presently design and develop. An example of
these objects are Buttons and Textboxes controls.
 The Solution Explorer – tracks the item in our projects. If we want
to add new items on our project, we simply use the menu items in
our project menu, such as Add Windows Form.
 Properties Window – is docked right under the Solution Explorer
window. It provides us the lists of the property settings from the
currently selected form or other control objects.
- A property in Object-Oriented Programming (OOP) term is a
characteristic of an object such as its size, caption or color.
 Output Window – echoes the result when we build and run our
programs. This is where the debugging results occur.
 Context Menus – contain shortcuts to our frequently performed
commands. To open the context menu, we simply click the right
mouse button on the control or object we are currently using.
 Form Designer – is our drawing board where we design
graphically the layout of the form and controls of our application
system.
 In short, this is where we draw our graphical-user interface
(GUI). Here we can add controls, pictures, or other
graphics to a form to design the look we want.
 Code Designer – it serves as a program editor where
we can write our program (code) behind each form and
control (object) we design or where we can place the
code module we develop in our application system.
 The IntelliSense – is a box that pops-up as we write the
code into our Code Designer and lists all possible options
and even completing our typing of code for us.
Creating an Application in Visual
Studio
Steps in Creating an Application in
Visual Studio
STEP 1
To create a new project, click the file menu in the menu bar
and click new project or click the new project dialog.
Steps in Creating an Application in
Visual Studio
STEP 2
Choose an application that you will do but in this step,
choose windows forms application
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 3
Drag and Drop Button, Label and Textbox into the Form
Designer
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 4
Change the text of Button and Label by going to properties
window and to text, then change the name of Button and
Label
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 5
OPTIONAL: Change the background of the application by
going to properties window and click BackColor to change
the background color of the application or click
BackgroundImage to change the background image of
the application
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 6
Double Click the Button1 or Display and then you will see
the code designer where you will generate code for the
Button1 or Display
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 7
For the application to work, we will write some code for
Button1 or Display
Steps in Creating an Application in
Visual Studio
Steps in Creating an Application in
Visual Studio
STEP 8
Run the Application
Steps in Creating an Application in
Visual Studio