info-0212 introduction to visual...

85
INFO-0212 INTRODUCTION TO VISUAL BASIC C. Keller Tuesday, May 05, 2015

Upload: others

Post on 10-Oct-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

INFO-0212 INTRODUCTION TO VISUAL BASIC

C. Keller

Tuesday, May 05, 2015

Page 2: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Agenda

• Course Administration1

• Programming2

• Visual Studio3

• THE VB IDE4

Page 3: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

About You

• Name:

• Occupation:

• Programming Experience:

• Why are you here?

13 May 2015 INFO 0212 – Introduction to Visual Basic 3

Page 4: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Your Lecturer

• IT Consultant

• IT Manager for regional organisation

• > 25 yrs. IT experience

• BSC Computer Science & MBA

• Email address:– [email protected]

13 May 2015 4INFO 0212 – Introduction to Visual Basic

Page 5: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Requirements

• Textbook

– Microsoft Visual Basic 2010 Reloaded

• Software and Materials

– Microsoft Visual Basic 2010

Express

– Jump drive or CD-ROM

13 May 2015 INFO 0212 – Introduction to Visual Basic 5

Page 6: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Course Overview

Introduction to fundamentals of:

• Windows Applications

• Event-driven programming

• The Graphical User Interface (GUI)

13 May 2015 INFO 0212 – Introduction to Visual Basic 6

Page 7: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Course Objectives

• Procedure vs. object-oriented

• GUI’s and Event Procedures

• Arithmetic operations,

• selection and iteration

• Programs for business management

• Data manipulation

13 May 2015 INFO 0212 – Introduction to Visual Basic 7

Page 8: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Methodology

• 12 classes

• PowerPoint presentations, discussions, case studies.

• Assigned readings must be completed prior to class

• Consultation time: ½ hour before and after class (with appointment)

13 May 2015 INFO 0212 – Introduction to Visual Basic 8

Page 9: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Teaching Methodology

• 1 ½ - 2 hours of explanations of concepts via PowerPoint presentations

• 1 -2 hours of

practical work on

the topic

Page 10: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Course Requirements

In order to successfully complete this course, the student must:

• Attain an overall passing grade of 50 percent.

• Maintain satisfactory attendance.

• Complete all assignments, including all required paperwork and documentation.

• It is the student's responsibility to make sure his/her work has been completed and received by the instructor

13 May 2015 INFO 0212 – Introduction to Visual Basic 10

Page 11: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Course Requirements

• Professional Behaviour

• Cell Phones

• Internet

13 May 2015 INFO 0212 – Introduction to Visual Basic 11

Page 12: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Evaluation and AssessmentBehaviour/Activity % of final Mark

Participation / Attendance 10%

Book Questions 15%

Assignments (3 @ 5% each) 15%

Mid Term Examination 10%

Final Examination 50%

TOTAL 100%

13 May 2015 INFO 0212 – Introduction to Visual Basic 12

Page 13: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Participation

• The quality of your contribution will weigh more heavily than the quantity, in the evaluation of your participation.

• Quality comments possess one or more of the following attributes:

a) They offer a different, unique and relevant perspective on the issue;

b) They respond to the current flow of the discussion and enhance it;

c) They move the discussion and analysis forward;d) They build on others’ comments; ande) They demonstrate critical or reflective thinking.

13 May 2015 INFO 0212 – Introduction to Visual Basic 13

Page 14: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Academic Honesty

• Academic honesty plays a key role in our efforts to maintain a high standard of academic excellence and integrity. Students are advised that ALL acts of intellectual dishonesty will be handled in accordance with ROYTEC Academic Policies and Procedures.

• Students are encouraged to read the School's Handbook on the penalties for plagiarism and other academic offenses. (http://www.roytec.edu/index.php?option=com_docman&task=cat_view&gid=36&Itemid=58).

Page 15: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Web Resources

• Student Resource Centre

– Class Materials

– Class Forums

– Past Papers

Log on with:

– Student ID and Computer Password

13 May 2015 INFO 0212 – Introduction to Visual Basic 15

Page 16: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Week Topic Reading Activities

1 -2May 5, 12

Introduction to VB Programming

Chapters 0Chapter 1

Pg. 74 Pencil and Paper exercises: 2,4,5 Pg. 76 Computer exercise 10Pg. 78 Case Project: Elvira Learning

3May 19

Creating a GUI Chapter 2 Pg. 134 Pencil and Paper exercises 2, 5,7Pg. 136 Computer exercise 16Pg. 138 Sophia’s Italian Deli

4May 26

Memory Chapter 3 Pg. 198 Pencil and Paper exercises 1,3,5Pg. 201 Computer exercise 17Pg. 204 Quick Loans

5-6June 2June 9

Selection Structure Chapter 4Chapter 5

Oct 1 - Assignment 1 due(Chapters 1-3 Activities)

Pg. 250 Pencil and Paper exercises 2,4,10Pg. 253 Computer exercise 18Pg. 256 Case Project :Marcy’s Department StorePg. 256 Addition Practice

7June 16

Mid Term Exam All Completed Chapters Pg. 297 Pencil and Paper exercises 1,2, 7Pg. 306 Jason’s Coffee Shop

8,9June 23,30

Repetition Structure Chapter 6Chapter 7

Pg. 364 Pencil and Paper exercises 1,7,14Pg. 368 Computer exercise 26Pg. 373 Case Project: Cook CollegePg. 374 Powder Skating RinkPg. 416 Pencil and Paper exercises 1, 6,8Pg. 418 Computer exercise 18Pg. 421 Case Project: Happy TempsPg. 422 South Central Investments

10July 7

Arrays Chapter 9 Pg. 529 Pencil and Paper exercises 1,2,4,6,8Pg. 530 Computer exercise 17

11July 14

MenusAdding a YouTube VideoCreating a web Browser

Chapter 10

12July 21

Review of Topics & Final Assignment

All Chapters

Page 17: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Assignments

• Grading criteria: – Correct execution, logical structure, good

programming techniques, quality of GUI (appearance, readability, layout, design, ease of use), adherence to instructions, etc.

• Submission will be by email or in class and are due by the end of class. It is your responsibility to ensure that the assignment was submitted.

• Time of submission will be determined by time stamp of projects received.

• Late projects will lose 10 percentage points for each day late.

Page 18: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

1. Overview of Programming & Programming Languages

Page 19: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

2. Why Visual Basic

Page 20: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

3. Visual Studio 2010

Page 21: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

4. The VBIDE

Page 22: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

1. OVERVIEW OF

PROGRAMMING & PROGRAMMING

LANGUAGES

13 May 2015 22INFO 0212 – Introduction to Visual Basic

Page 23: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

23

What Is a Computer?

• A computer is a device that can perform calculations and make logical decisions much faster than humans can.

• Computers process data, using sets of instructions called computer programs.

– These programs guide computers through orderly sets of actions that are specified by people known as computer programmers.

Page 24: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming
Page 25: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming
Page 26: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

300

Page 27: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

300 mph

Page 28: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

3:00 pm

Page 29: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

300

Page 30: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming
Page 31: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

What is Programming?

13 May 2015 INFO 0212 – Introduction to Visual Basic 35

Page 32: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Why become a programmer?

• Programmers make lots of money.

• Programming really is fun.

• Programming is very intellectually rewarding.

• Programming makes you feel superior to other people.

• Programming gives you complete control over an innocent, vulnerable machine, which will do your evil bidding with a loyalty not even your pet dog can rival

13 May 2015 INFO 0212 – Introduction to Visual Basic 36

Page 33: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Who can be a programmer?

a good programmer:

• Logical

• Patient

• Perceptive

• At least moderately intelligent

• Enjoys an intellectual challenge

• Sci-Fi fan

13 May 2015 INFO 0212 – Introduction to Visual Basic 37

Page 34: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

What’s involved in programming

Planning

Analysis

Design

Implement

Test

Maintenance

13 May 2015 INFO 0212 – Introduction to Visual Basic 38

Page 35: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

The Job Market & Opportunities

13 May 2015 INFO 0212 – Introduction to Visual Basic 39

Page 36: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

40

Types of Programs?

Page 37: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

41

Batch ProgramsBatch processing is execution of a series of programs ("jobs") on a computer without manual intervention. They tend to follow a pattern of:

– Take a set of data files as input– Read input data – Process that data – Print or store results

Key feature: No user interaction with the computer while the program is running

Page 38: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Example: Simple Batch Program:: Here's a routine that generates a pseudo random number

:: from 0 to 9. It does it by grabbing the hundredths

:: of a second digit from the TIME command. It finishes

:: by setting the environment variable RANDOM.

::-----------------------------------------

@echo off

echo.|time|find "Current" >cu##ent.bat

echo set time=%%3> current.bat

call cu##ent.bat

del cu??ent.bat > nul

echo = | choice /c=%time%= temp2.bat > temp1.bat

echo shift>temp2.bat

echo shift>>temp2.bat

echo set RANDOM=%%9>>temp2.bat

call temp1.bat

del temp?.bat > nul

42

Page 39: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

43

Event-Driven ProgramsExamples? GUIs, microwave, camera

The system sends events to the program and the program responds to these as they arrive.

Events can include things a user does - like clicking the mouse - or things that the system itself does - like updating the clock.

These programs generally work as follows:

– Initialize the internal data

– Wait for events to arrive

– Identify an incoming event and react accordingly

Page 40: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

44

ProgrammingLanguage?

Page 41: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

45

A vocabulary and set of grammatical rules for

instructing a computer to perform specific tasks

Page 42: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Learning a Programming Language• Syntax

• Structure

• Rules

• Punctuation

• Reserved Words (keywords) eg. If, Else

• Visual Basic.NET is NOT case sensitive. MyCase is the same as myCase and MYCASE.

• Comment lines start with an apostrophe (')

46

Page 43: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

47

Machine, Assembly and High-Level Languages

• Programmers write instructions in programming languages. Some of these are directlyunderstandable by computers, and others require intermediate translation steps.

• Computer languages that are in use today can be divided into three general types:

– machine languages

– assembly languages

– high-level languages

Page 44: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

48

Machine, Assembly and High-Level Languages

• A computer can directly understand only its own machine language.

• As the “natural language” of a particular computer, machine language is defined by the computer’s hardware design. Machine languages are machine dependent.

• Machine languages generally consist of streams of numbers (ultimately reduced to 1s and 0s in the binary number system).

Page 45: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming
Page 46: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

50

Machine, Assembly and High-Level Languages

• The following section of a machine-language program demonstrates the incomprehensibility of machine language to humans:+1300042774+1400593419+1200274027

• Machine-language programming proved to be slow and error prone.

Page 47: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

51

Machine, Assembly and High-Level Languages

• Programmers began using English-like abbreviations to represent the computer’s basic operations.

• These abbreviations formed the basis of assembly languages.LOAD BASEPAYADD OVERPAYSTORE GROSSPAY

Page 48: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

52

Machine, Assembly and High-Level Languages

• Translator programs called assemblers convert assembly-language programs to machine language.

• Although it is clearer to humans, computers cannot understand assembly-language code until it is translated into machine language.

• Assembly languages still require many instructions to accomplish even the simplest tasks.

Page 49: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

53

Machine, Assembly and High-Level Languages

• To speed up the programming process,high-level languages were developed.

• Programs called compilers convert high-level-language programs into machine language.

• High-level languages look almost like everyday English and contain common mathematical notations.grossPay = basePay + overTimePay

• Visual Basic is one of the world’s most popularhigh-level programming languages.

Page 50: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

13 May 2015 INFO 0212 – Introduction to Visual Basic 54

Page 51: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

VISUAL BASIC

13 May 2015 INFO 0212 – Introduction to Visual Basic 55

Page 52: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

56

Visual Basic

• Visual Basic evolved from BASIC (Beginner’s All-purpose Symbolic Instruction Code), which was developed as a language for writing simple programs quickly and easily.

• When Bill Gates founded Microsoft Corporation in the 1970s, he implemented BASIC on several early personal computers.

Page 53: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

57

Visual Basic

• In the late 1980s and the early 1990s, Microsoft developed the Microsoft® Windows® graphical user interface (GUI).

• Visual Basic was introduced by Microsoft in 1991 to make programming Windows applications easier.

• a visual history of the windows gui

Page 54: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

58

Visual Basic

• Visual Basic is a so-called object-oriented,event-driven visual programming language.

• Programs are created with the use of a softwaretool called an Integrated Development Environment (IDE).

• The latest versions of Visual Basic are fully object oriented and respond to user-initiated events such as mouse clicks, keystrokes and timers.

• In Visual Studio, it is convenient to make programs by dragging and dropping predefined objects like buttons and textboxes.

Page 55: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

VB IDE

13 May 2015 INFO 0212 – Introduction to Visual Basic 59

Page 56: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Chapter 1 - VB 2005 by Schneider 60

Mouse Actions Event examples:

– Pointing

– Hovering

– Clicking

– Double-Clicking

– Dragging

Page 57: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

61

Visual Basic

• Microsoft introduced its .NET strategy in 2000.• The .NET platform allows applications to be

distributed to a variety of devices.• Software components created in different .NET

programming languages can communicate with one another.

Page 58: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

62

Other High-Level Languages

• Although hundreds of high-level languages have been developed, only a few have achieved broad acceptance.

• IBM Corporation developed Fortran in themid-1950s to create scientific and engineering applications.

• COBOL was developed in the late 1950s by a group of computer manufacturers. COBOL is used primarily for business applications that require the manipulation of large amounts of data.

Page 59: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

63

Other High-Level Languages

• The C language gained widespread recognition asa development language for the UNIX operating system.

• C++ was developed by Bjarne Stroustrup in the early 1980s at Bell Laboratories. C++ provides capabilities for object-oriented programming (OOP).

– Objects are reusable software componentsthat

model items in the real world.

– Object-oriented programs are easier to understand, correct and modify.

Page 60: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

64

Other High-Level Languages

• Developers use Java to create web pages with dynamic content, to build large-scale enterprise applications, to enhance the functionality of web servers, and to provide applications for consumer devices.

• In 2000, Microsoft announced C#. The C# programming language was designed specifically for the .NET platform. Like Visual Basic, C# is object oriented and has access to .NET’s library.

Page 61: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

65

Machine LanguageAssembly Language (1956-63)LISP (1956)Fortran (1957)COBOL (1959)PL/1(1964)BASIC (1964)Pascal (1970)Smalltalk (1972)C (1972)

Ada(1983) C++ (1983-85) QBasic (1986)Perl (1987)VisualBasic (1991)PowerBuilderJava (1995)JavaScriptC# (2001)

Page 62: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

66

Object Technology• Object technology is a packaging scheme for

creating meaningful software units.• Almost any noun can be reasonably represented

as a software object.• Objects:

– have properties such as color, size and weight– perform actions such as moving, sleeping or drawing

• A class specifies the general format of its objects, and the properties and actions available to an object depend on its class.

Page 63: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Generalization Hierarchy

• Object-oriented design tool used to show the relationships among classes of objects

p. I.11

Page 64: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Object Structure Diagram

p. I.12

Page 65: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

69

Object Technology

• Procedural programming languages focused on actions (verbs) rather than objects (nouns).

• Object-oriented languages more naturally reflects the way in which we perceive the world.

• This has resulted in significant productivity gains.

– Properly designed classes can be reused on future projects

– Using libraries of classes reduces the amount of effort required to implement new systems

– The production of software is more understandable because it is better organized and has fewer maintenance requirements.

Page 66: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

70

Object Technology

• Instead of worrying about the details of how objects are implemented, you can focus on the behaviors and interactions of objects.

• Visual Basic is one of the world’s most widely used object-oriented languages.

Page 67: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

85

• Visual Studio® 2010 is Microsoft’s integrated development environment (IDE) for creating, running and debugging applications.

• The IDE allows you to create applications by dragging and dropping existing building blocks into place.

• This technique is called visual programming.

• It is a Rapid Application Development (RAD) tool because it is focused on productivity.

Visual Studio 2010 IDE

Page 68: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Visual Studio 2010 Languages

• Visual Basic.NET

• C# (pronounced C-Sharp)

• J# (pronounced J-Sharp)

• C++ (pronounced C plus plus)

• ASP.NET (web page creation)

86

Page 69: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

13 May 2015 INFO 0212 – Introduction to Visual Basic 87

Page 70: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Visual Basic 2010 Express• Visual Basic Express is a compact development

environment for creating Visual Basic.NET applications.

• Can create different types of applications– Windows Applications (Windows Forms or WPF

Application)– Console Applications– Reusable components or class libraries

• Cannot build web sites or web services with the Visual Basic Express Edition.

88

Page 71: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Visual Basic 2010 Express

To download for home use

• Google “Visual Basic 2010 Express”

• Visual Basic 2010 Express - Microsoft

• go.microsoft.com/fwlink/?linkid=323467

• http://www.visualstudio.com/en-us/downloads#d-2010-express

• Scroll down to Visual Studio 2010 Express

• Click on Visual Basic 2010 Express

13 May 2015 INFO 0212 – Introduction to Visual Basic 89

Page 72: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Some Advantages of VB 2010 Express IDE

• Greatly reduces amount of code you must write

• Automatically colors code depending what it is

– Comments are Green

– Keywords are Blue

• Organizes code in separate files

• IntelliSense

– Code Snippets

• Real-time compiler feedback

– Blue squiggle under code indicates an error

– Green squiggle under code indicates a possible error90

Page 73: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Solutions and Projects• Visual Basic organizes applications into solutions

and projects.

• Solutions contain one or more projects.

• A project is a group of related files, such as codeand images that might make up a program.

91

Page 74: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Solutions, Projects, and Files

Page 75: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

13 May 2015 INFO 0212 – Introduction to Visual Basic 93

Page 76: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

13 May 2015 INFO 0212 – Introduction to Visual Basic 94

Page 77: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

13 May 2015 INFO 0212 – Introduction to Visual Basic 95

Page 78: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Creating a New Project• Select either File > New Project…, which

creates a new project, or File > Open Project…, which opens an existing project.

• From the Start Page, under the Recent Projects section, click the link Create: Project… or Open: Project….

• Click either the New Project Button or the Open File Button.

97

Page 79: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Working With a Project• The Solution Explorer window displays a list of

the files in a project and the projects in a solution.

• The Properties window displays an object’s attributes, such as its size, color and position. The Properties window allows you to set object properties visually without writing code.

• Using visual programming, you can “drag and drop” controls onto the Form from the Toolbox.

98

Properties icon Object Browser icon

Toolbox icon Solution Explorer icon

Page 80: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

99

Figure 2.22 | Properties window displaying a Form’s properties.

Object’s

name(Form1)

Object’s class (System.Windows.Forms.Form)

Down arrow for selecting Form

or control objects

Items that have been

changed from their default

values (by the user or by Visual

Studio) are listed in bold

Property values

(right column)

Properties

(left column)

Description of

selected property

Design category

Selected property

Alphabetical icon

Categorized icon

Component object box

Properties Window

Page 81: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Book Resources

• Cengage Learning

• English Catalogue

• Search for “Microsoft Visual Basic 2010 Reloaded” Diane Zak 4th edition (yellow)

• ACCESS FREE CONTENT – blue button

• Access now – white button

• Student Data Files & Videos – download and save to thumb drive

13 May 2015 INFO 0212 – Introduction to Visual Basic 100

Page 82: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Form Controls

Page 83: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Wizard Tutorial

Control Name Text

Form MainForm Wizard Viewer

Label Label1 Wizard

Show Button showButton Show

Hide Button hideButton Hide

Exit Button exitButton Exit

Wizard Picture wizardPictureBox

13 May 2015 INFO 0212 – Introduction to Visual Basic 102

Picturebox choose pictue– size mode “autosize

Page 84: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

Wizard Tutorial Continued

• Show button

wizardPictureBox.Visible = True

• Hide button

wizardPictureBox.Visible = False

• Exit Button

Me.Close()

13 May 2015 INFO 0212 – Introduction to Visual Basic 103

Page 85: INFO-0212 INTRODUCTION TO VISUAL ASICchristopherkeller.weebly.com/uploads/5/4/2/2/54227861/lecture_1.pdf · •Grading criteria: –Correct execution, logical structure, good programming

QUESTIONS?

13 May 2015 107INFO 0212 – Introduction to Visual Basic