Microsoft Visual Basic 2015
Week 1 Lecture 2
(chap 1)
Introduction to Visual
Basic 2015 Programming
1 Objectives
►Learn about the language of a computer.
►Explain the history of programming languages
►Examine high-level programming languages.
►See example code of some high-level
programming languages.
►Talk about VB.NET
2
1 Programmers
►People who write programs.
►A computer program is designed and developed by
people known as computer programmers, or
developers
►Developers are people skilled in designing computer
programs and creating them using programming
languages
►Applications may consist of several computer
programs working together to solve a problem
►Developers write the code for programs using a
programming language
Chapter 1: Introduction to Visual Basic 2015 Programming 3
1 Programs
►The set of instructions that directs a computer to
perform tasks is called computer software, or a
computer program
►A computer program on a mobile device or
Windows 8 or Windows 10 computer is also called an
app
Chapter 1: Introduction to Visual Basic 2015 Programming 4
1 Language of a Computer
►Machine Languages
• 0 (for on switch)
• 1 (for off switch)
• Tedious and prone to error
• Every computer directly understands its own
machine language.
• Early computers programmed in machine
language.
5
1 Language of a Computer
6
1 A Brief History of Programming
Languages (continued)
►Assembly Languages
• More advanced than machine languages
• Mnemonics (memory aids)
• Examples: MUL b1, ax
• Require an assembler: Translates assembly
language instructions into machine language.
• Developed to make programmer’s job easier.
7
1 Instructions in Assembly and Machine
Languages
8
1 A Brief History of Programming
Languages (continued)
►High Level Languages
• Require Interpreter or compiler
►Interpreter translates high-level into machine code
line-by-line while program is running
►Compiler translates entire program before program
has run
• English like syntax, closer to spoken langauages
• Allow for object-oriented programming
►Programmer focuses on using objects to achieve the
program’s goal
9
1 A Brief History of Programming
Languages (continued)
►Examples:
• Basic
• Pascal
• FORTRAN
• COBOL
• C/C++
• Java
• Python
• Perl
10
1
Python Fortran 95
for intNum in range(1, 6): DO intNum = 1, N
a = b + intNum a = b + intNum
END DO
.NET Pascal
For intNum = 1 To 3 Step 1 for intNum := 1 to 3 do
a = b + intNum a = b + intNum;
Next intNum
C/C++
for(intNum = 1; intNum <= 3; intNum+=1) Ruby
a = b + intNum; 1.upto(5) do |counter|
a = b + intNum;
JAVA
for(intNum = 1; intNum <= 3; intNum+=1)
a = b + intNum;
11
1 Visual Basic .NET
►Why VB .NET?
►What’s useful about VB .NET?
►In what areas can we use VB.NET?
12
1 A walk down memory lane…
1991, VB1 Debuts …
1997, VB5 Debuts
1998, VB6 Debuts
2001, VB. NET Debuts
2010, VB (10.0)
2012, VB (11.0)
2015, VB (14.0)
►Most VB.NET syntax is based on Basic, which is fairly
easy to understand
13
1 Visual Basic .NET
►As you’ll see, most code is easy to understand and
looks a lot like English
►Visual Basic makes it very easy to create a Windows
program
►Thought Problem #1: What are some of the elements
you expect to see in a Windows program?
14
1 Thought Problem #1 (soln)
►Elements:
• Window (form), button, textbox, label, radio
button, checkbox, dropdown listbox, slider ..e.t.c
►VB.NET makes it very simple to create a program with
all these elements
• Drag and drop these elements right into a window
15
1 Example Program
► Simple Pacific Greeting program written in VB.NET
► Single window
► GUI Interface
• By the end of this course (if you work hard), you should
be able to create more sophisticated programs than
this one.
16
1 Example Program
►This program probably took me a few minutes to write
using VB.NET
►If I tried to do it in C++, it would take a day at least!
• For those of you who’ve taken CS 111, remember
that everything you’ve ever written for that course
has a terminal interface rather than a graphical
interface
• Master VB.NET and you master programming the
Windows interface, which is the most popular user
interface in the world (by far!)
17
Event-Driven Computer Programs
1 with a Graphical User Interface
►Most Visual Basic 2015 programs are event-driven
programs that communicate with the user through a
graphical user interface (GUI)
• A GUI usually consists of a window, containing a
variety of objects
►An event means the user has initiated an action that
causes the program to perform a type of processing in
response
Chapter 1: Introduction to Visual Basic 2015 Programming 18
Event-Driven Computer Programs
1 with a Graphical User Interface
►For example:
• The user enters data into the program
• The user taps or clicks a button
Chapter 1: Introduction to Visual Basic 2015 Programming 19
1 Input Operation
Chapter 1: Introduction to Visual Basic 2015 Programming 20
1 Output Operation
Chapter 1: Introduction to Visual Basic 2015 Programming 21
1 Types of Visual Basic 2015 Applications
►Windows Desktop application
• Program will run on a computer or other device
that supports the Windows GUI
►Windows Store app
• Designed to run on Windows 8 or Windows 10
computers and mobile devices
►Web application
• Uses ASP.NET 5 and runs on a web server
Chapter 1: Introduction to Visual Basic 2015 Programming 22
1 Types of Visual Basic 2015 Applications
► Office/SharePoint application
• Automates and manipulates documents created using
Microsoft Office 2010 or Office 2013 and SharePoint
► Database application
• Written using ADO.NET 4.6 to reference, access, display, and
update data stored in a database
► Other types of applications include console applications, classes
for class libraries, certain controls to use in Windows
applications, reporting applications, LightSwitch business
applications using Silverlight, and device-specific applications
Chapter 1: Introduction to Visual Basic 2015 Programming 23