Introduction to Visual Basic - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Introduction to Visual Basic

Description:

Form, Project Explorer, Properties, and Form Layout Windows. Toolbox. Main Visual Basic window ... The Name property identifies the object internally--so you ... – PowerPoint PPT presentation

Number of Views:284
Avg rating:3.0/5.0
Slides: 21
Provided by: drjames82
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Visual Basic


1
Chapter 1
  • Introduction to Visual Basic

2
Introduction to Visual Basic
  • Objective Writing windows applications with
    Visual Basic
  • Programming languages Language for communicating
    with a computer
  • Machine Code (Machine Language)
  • Assembly Language
  • High Level Language
  • The VB environment
  • Writing your first VB project
  • Finding fixing errors

3
Definitions and Terms
  • Program/Programmer
  • User
  • Algorithm
  • See p. 12-13
  • Disk File Folder Filename Path
  • Directory Subfolder Root Folder
  • Graphical User Interface (GUI)
  • Point, Click, Double-Click, Hover

4
Graphical User Interface
  • Visual Basic allows you to create GUIs
  • Graphic User Interface (GUI) comprises
  • Forms
  • Controls
  • Event-driven programming
  • Revolutionized the Computer Industry
  • Allows input forms or boxesmuch friendlier
    interface

5
Writing Windows Applications with Visual Basic
  • The Windows GUI

6
Graphic User Interface
  • Controls The responsive objects a programmer
    places on a window
  • These objects recognize user actions such as
    mouse movements and button clicks
  • A good analogy For Example
  • Objects (nouns) Option button
  • Properties (adjectives) What it looks like
  • Methods (verbs) What it does

7
Planning Visual Basic Projects
  • The three-step process for planning projects
  • (p. 21)
  • Design the user interface
  • Sketch the screens with forms and controls needed
  • Establish the objects' properties
  • Write down the properties for each object
  • Plan the Basic code
  • Write out pseudocode for actions your program
    will perform

8
Writing Visual Basic Projects
  • The three-step process for writing projects
  • Design the user interface
  • Create the forms and controls you previously
    sketched
  • Set the objects' properties
  • Give each object a name and set their properties
  • Write the Basic code
  • Write out Visual Basic code to carry out your
    application's actions

9
When the Program is Running
  • Visual Basic monitors the controls in the window
    to detect any event (click, for example)
  • When events detected, examine program to see if
    theres a procedure associated with it
  • If there is a procedure, execute it
  • If there is no procedure, wait for the next event

10
The Visual Basic Environment
  • Form, Project Explorer, Properties, and Form
    Layout Windows
  • Toolbox
  • Main Visual Basic window
  • Toolbar, Form location size information
  • Help
  • Design- , Run-

11
The Toolbox
  • Tool box contents vary based on which version of
    Visual Basic you are running.
  • Toolbox contains a common set of tools across all
    VB versions
  • Visual Basic Toolbar
  • The buttons on the toolbar are shortcuts
  • Toolbar buttons are a quick way to activate
    frequently used commands
  • Each button stands for a command that you can
    also select a the Visual Basic menu

12
Writing Your First VB Project
  • Set up your Visual Basic workspace
  • Define user interface
  • Set properties
  • Write code
  • Visual Basic code statements
  • Run, save, open, modify, print the Hello World
    project
  • Documentation

13
Set Up Your VB Workspace
  • Set up Options to reflect these settings

14
Define the User Interface
  • Resize the form
  • Drag the lower-right handle to enlarge the form
  • Drag any handle in the middle of a side to
    enlarge the form in that direction only
  • Place controls on the form
  • Click the label tool
  • Click and drag the mouse (a crosshair) to place
    the control on the form

15
Set Properties
  • Set the Name and Caption properties
  • Always set the Name property before writing code
  • Next, set the Caption property
  • The Name property identifies the object
    internally--so you can refer to it in code
  • The Caption property externally idenfities an
    object

16
Write Code
  • You write code enclosed in event procedures,
    which respond to typical VB events.
  • Private Sub cmdPush_Click()
  • . . . (your code goes here)
  • End Sub
  • VB automatically supplies the event procedure
    Sub/End Sub statements

17
Visual Basic Code Statements
  • Remark statement is any code line beginning with
    an apostrophe
  • Assignment statement
  • End statement

18
Run/Save/Open/Modify the Project
  • Test the project
  • Click Run, Start
  • (or click the Start button on the toolbar)
  • Click the Push Me button
  • Click the Exit button
  • Save the project and the form
  • Make modifications to the form
  • Print the project documentation
  • Form Image, Code, and Form as Text

19
Finding fixing errors
  • Compile (syntax) errors
  • Run-Time (semantic) errors
  • Logic errors
  • Project Debugging

20
Homework
  • Text Box Walkthrough p. 43
  • Command Button Walkthrough p. 49
  • Label Walkthrough p. 50
  • Picture Box Walkthrough p. 51
Write a Comment
User Comments (0)
About PowerShow.com