Documente Academic
Documente Profesional
Documente Cultură
Week 1 Lecture 2
(chap 1)
Introduction to Visual
Basic 2015 Programming
1 Objectives
2
1 Programmers
►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…
13
1 Visual Basic .NET
14
1 Thought Problem #1 (soln)
►Elements:
• Window (form), button, textbox, label, radio
button, checkbox, dropdown listbox, slider ..e.t.c
15
1 Example Program
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