VISUAL PROGRAMMING
STAFF NAME : D.SARITHA
ASSISTANT PROFESSOR
DEPARTMENT OF COMPUTER APPLICATIONS
BON SECOURS COLLEGE FOR WOMEN
THANJAVUR
UNIT : I
CHAPTER : 1
TOPIC : INTRODUCTION TO VISUAL BASIC
INTRODUCTION TO
VISUAL BASIC
PERFORMING A TASK ON THE COMPUTER
 Determine Output
 Identify Input
 Determine process necessary to turn given
Input into desired Output
PICTORIAL REPRESENTATION OF THE PROBLEM
SOLVING PROCESS
WHAT IS VISUAL BASIC?
 High Level 4th Generation Programming
Language
 Object and Event Driven
 Visual - Windows Based
 Integrated Development Environment or IDE
WHAT IS VB USED FOR?
 Most Popular Programming Language
 Stand alone programs
 Applets that can be run on many different
kinds of computers
 Customized specialized Applications
 E- Commerce
 Web based shopping forms and inquiries
 User friendly Interface to applications
l l l l l l
Used by a computer equipment retail outlet to
record data regarding customer orders.
EXAMPLE ORDER ENTRY SCREEN
Allows user to use a mouse to click on boxes for text entry.
Also enables user to click on buttons
to initiate processing steps.
GENERATIONS OF COMPUTER LANGUAGES
 1st - Machine language - 0110 0011 1000
 2nd - Procedure-oriented languages
 FORTRAN - 1954 for scientists and engineers
 COBOL - 1959 for business applications
 C - 1972 - for UNIX operating systems
 3rd - Object-oriented languages
 4th - Event-driven languages - i.e.VB
 5th - Natural languages i.e. English
COMPILER VS INTERPRETER
 Higher Languages are translated to
Machine Language by:
Interpreter
 Translates instructions to machine code line-by-
line.
 BASIC, Quick Basic, Visual Basic
Compiler
 Translates the entire program to machine code
before running it.
 Fortran, C, C++, Visual Basic is also a compiler
WHAT ARE THE OBJECTS IN VB?
 Pre-programmed Code
for:
 Command Buttons
 Labels
 Pictures
 Text Boxes
 Have both data and
procedures wrapped
together
WHAT ARE THE EVENTS?
 Visual Basic “watches” what the user does
 A user activity is called an event
 Events include mouse clicks and moves, menu
selections, button presses, etc.
 Sections of code are only executed in response to
an event
WHAT IS THE INTEGRATED DEVELOPMENT
ENVIRONMENT (IDE)?
VISUAL BASIC ENVIRONMENT
GUI (Graphical User Interface) - forms and
windows that the user sees
Property - a characteristic or attribute of an object
such as color and size
Event - a user action such as clicking a button
Code Editor window - editor specially designed to
help you when writing code
VISUAL BASIC ENVIRONMENT
Components of the VB design environment
(Form view)
VISUAL BASIC ENVIRONMENT
Components of the VB design environment
(Code view)
THE CODE EDITOR WINDOW
Object List Box
Procedure List Box
Auto List Members
Full Module View
button
THE CODE EDITOR WINDOW
Help
window
Error message box
Syntax error in Red
Procedure view button
VB ENVIRONMENT: PROJECT WINDOW
The Project Window can be used to navigate
between the code and form window for each form
/ window a project has
VB ENVIRONMENT: MENU BAR
The Menu Bar consists of 3 elements the
 Title Bar, which holds the name of application, default
if Microsoft Visual Basic [design]
 Menu Bar, this is the link to Visual Basics menu
facilities, each menu option drops down into sub-
menus
 Toolbar, contains icons which give access to the more
commonly used commands (which are also available
through the menu bar)
Title bar Menu Bar Toolbar
VB ENVIRONMENT: PROPERTIES WINDOW
Used to set how a control
looks and
behaves
Holds its default values
VB ENVIRONMENT CONTROL TOOLBOX
VB ENVIRONMENT: CONTEXT SENSITIVE
HELP
 Context sensitive help is very useful
 Select the item control that you want help on
 Press the F1 key
F1
THE FILE MENU
Project commands
Make executable commands
Most recent project list
Exit command
THE FILE MENU
 New Project
 Open Project
 Add Project
 Remove Project
 Save Project
 Save Project As
 Save Component
 Save Component As
 Print
 Print Setup
THE FILE MENU
Template - particular pattern for a project or a project
element; start a project from a template saves
time
Existing tab - displays VB projects
Recent tab - displays most recently accessed
projects
Project Groups - a collection of several projects
BUILDING YOUR FIRST APPLICATION
 There are three primary steps in building a
Visual Project:
 Place (or draw) controls on the form.
 Assign properties to the controls.
 Write event procedures for the controls.
PROJECT FILES
vbp extension = Visual Basic Project
 file that tracks all components
frm extension = Form file
 separate file for each form
frx extension = Binary form file
 cannot be read by humans
vbw extension = Visual Basic workspace
VISUAL BASIC PROGRAM STRUCTURE
 Project File
◦ ‘.VBP’
 Form Files
◦ ‘.FRM’
◦ ‘.FRX’
 Modules
◦ ‘.BAS’
 Custom
Controls
◦ ‘.VBX’ files
 Save As...
◦ Possible
problem
STARTING VISUAL BASIC
CHOOSING PROJECT TYPE
PLACING CONTROLS ON THE FORM: IMAGE
ASSIGNING PROPERTIES TO CONTROLS
ADDING AN IMAGE
BROWSE FOR AN IMAGE
IMAGE DISPLAYED
BUTTONS AND TEXT BOXES
CHANGING THE FORM TITLE
WRITING THE CODE (EVENTS)
WRITING THE CODE (EVENTS)
RUNNING THE APPLICATION
RUNNING THE APPLICATION
THANK YOU

VISUAL PROGRAMMING

  • 1.
    VISUAL PROGRAMMING STAFF NAME: D.SARITHA ASSISTANT PROFESSOR DEPARTMENT OF COMPUTER APPLICATIONS BON SECOURS COLLEGE FOR WOMEN THANJAVUR UNIT : I CHAPTER : 1 TOPIC : INTRODUCTION TO VISUAL BASIC
  • 2.
  • 3.
    PERFORMING A TASKON THE COMPUTER  Determine Output  Identify Input  Determine process necessary to turn given Input into desired Output
  • 4.
    PICTORIAL REPRESENTATION OFTHE PROBLEM SOLVING PROCESS
  • 5.
    WHAT IS VISUALBASIC?  High Level 4th Generation Programming Language  Object and Event Driven  Visual - Windows Based  Integrated Development Environment or IDE
  • 6.
    WHAT IS VBUSED FOR?  Most Popular Programming Language  Stand alone programs  Applets that can be run on many different kinds of computers  Customized specialized Applications  E- Commerce  Web based shopping forms and inquiries  User friendly Interface to applications
  • 7.
    l l ll l l Used by a computer equipment retail outlet to record data regarding customer orders. EXAMPLE ORDER ENTRY SCREEN Allows user to use a mouse to click on boxes for text entry. Also enables user to click on buttons to initiate processing steps.
  • 8.
    GENERATIONS OF COMPUTERLANGUAGES  1st - Machine language - 0110 0011 1000  2nd - Procedure-oriented languages  FORTRAN - 1954 for scientists and engineers  COBOL - 1959 for business applications  C - 1972 - for UNIX operating systems  3rd - Object-oriented languages  4th - Event-driven languages - i.e.VB  5th - Natural languages i.e. English
  • 9.
    COMPILER VS INTERPRETER Higher Languages are translated to Machine Language by: Interpreter  Translates instructions to machine code line-by- line.  BASIC, Quick Basic, Visual Basic Compiler  Translates the entire program to machine code before running it.  Fortran, C, C++, Visual Basic is also a compiler
  • 10.
    WHAT ARE THEOBJECTS IN VB?  Pre-programmed Code for:  Command Buttons  Labels  Pictures  Text Boxes  Have both data and procedures wrapped together
  • 11.
    WHAT ARE THEEVENTS?  Visual Basic “watches” what the user does  A user activity is called an event  Events include mouse clicks and moves, menu selections, button presses, etc.  Sections of code are only executed in response to an event
  • 12.
    WHAT IS THEINTEGRATED DEVELOPMENT ENVIRONMENT (IDE)?
  • 13.
    VISUAL BASIC ENVIRONMENT GUI(Graphical User Interface) - forms and windows that the user sees Property - a characteristic or attribute of an object such as color and size Event - a user action such as clicking a button Code Editor window - editor specially designed to help you when writing code
  • 14.
    VISUAL BASIC ENVIRONMENT Componentsof the VB design environment (Form view)
  • 15.
    VISUAL BASIC ENVIRONMENT Componentsof the VB design environment (Code view)
  • 16.
    THE CODE EDITORWINDOW Object List Box Procedure List Box Auto List Members Full Module View button
  • 17.
    THE CODE EDITORWINDOW Help window Error message box Syntax error in Red Procedure view button
  • 18.
    VB ENVIRONMENT: PROJECTWINDOW The Project Window can be used to navigate between the code and form window for each form / window a project has
  • 19.
    VB ENVIRONMENT: MENUBAR The Menu Bar consists of 3 elements the  Title Bar, which holds the name of application, default if Microsoft Visual Basic [design]  Menu Bar, this is the link to Visual Basics menu facilities, each menu option drops down into sub- menus  Toolbar, contains icons which give access to the more commonly used commands (which are also available through the menu bar) Title bar Menu Bar Toolbar
  • 20.
    VB ENVIRONMENT: PROPERTIESWINDOW Used to set how a control looks and behaves Holds its default values
  • 21.
  • 22.
    VB ENVIRONMENT: CONTEXTSENSITIVE HELP  Context sensitive help is very useful  Select the item control that you want help on  Press the F1 key F1
  • 23.
    THE FILE MENU Projectcommands Make executable commands Most recent project list Exit command
  • 24.
    THE FILE MENU New Project  Open Project  Add Project  Remove Project  Save Project  Save Project As  Save Component  Save Component As  Print  Print Setup
  • 25.
    THE FILE MENU Template- particular pattern for a project or a project element; start a project from a template saves time Existing tab - displays VB projects Recent tab - displays most recently accessed projects Project Groups - a collection of several projects
  • 26.
    BUILDING YOUR FIRSTAPPLICATION  There are three primary steps in building a Visual Project:  Place (or draw) controls on the form.  Assign properties to the controls.  Write event procedures for the controls.
  • 27.
    PROJECT FILES vbp extension= Visual Basic Project  file that tracks all components frm extension = Form file  separate file for each form frx extension = Binary form file  cannot be read by humans vbw extension = Visual Basic workspace
  • 28.
    VISUAL BASIC PROGRAMSTRUCTURE  Project File ◦ ‘.VBP’  Form Files ◦ ‘.FRM’ ◦ ‘.FRX’  Modules ◦ ‘.BAS’  Custom Controls ◦ ‘.VBX’ files  Save As... ◦ Possible problem
  • 29.
  • 30.
  • 31.
    PLACING CONTROLS ONTHE FORM: IMAGE
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.