Visual Basic Application - PowerPoint PPT Presentation

About This Presentation
Title:

Visual Basic Application

Description:

Title: Visual Basic Application Author: Debra Chapman Last modified by: Debra Chapman Created Date: 10/18/2006 5:57:02 PM Document presentation format – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 15
Provided by: Debra175
Category:

less

Transcript and Presenter's Notes

Title: Visual Basic Application


1
Visual Basic Application
2
Problem
  • Create a Windows-based application that will
    calculate the Gross Pay earned for a worker,
    given the number of hours worked and hourly pay
    rate.

3
Problem Solving
  • Input (controls)
  • Hours Worked
  • Hourly Pay Rate
  • Process (event handling)
  • Calculate Gross Pay
  • Gross Pay hoursWorked hourlyPayRate
  • Output (controls)
  • Gross Pay

4
Creating the Visual Basic Application
  • Event Driven Programming
  • Create the Interface / Window first
  • Input
  • Output
  • Then Code the Application
  • Process
  • Event Handing Methods

5
Creating the Interface
  • Input
  • Hours Worked ? Textbox, Label
  • Hourly Pay Rate ? Textbox, Label
  • Output
  • Gross Pay Earned ? Label (title), Label (display
    info)
  • Events
  • Calculate Gross Pay ? Button
  • Exit Program ? Button

6
Design the Interface TOE Chart
Task (T) Object (O) Event (E)
Input Hours Worked Textbox, Label None
Input Pay Rate Textbox, Label None
Output Gross Pay Label (display), Label (title) None
Calculate Gross Pay Button Click
Exit Program Button Click
7
Create Your Interface
Label
Text Box
Label
Text Box
Label
Label
2 Buttons
8
Properties
  • Form1
  • Name frmWageCalculator
  • Text Wage Calculator
  • Label1
  • No Need to Rename (Display Only will not use)
  • Text Number of Hours Worked
  • Label2
  • No Need to Rename (Display Only)
  • Text Hourly Pay Rate
  • Label3
  • No Need to Rename (Display Only)
  • Text Gross Pay Earned

9
Properties
  • Textbox1
  • Name txtHoursWorked
  • Text ltblankgt
  • Textbox2
  • Name txtPayRate
  • Text ltblankgt
  • Label4
  • Name lblGrossPay (needs name because will will
    use this label)
  • Text ltblankgt
  • Autosize Off
  • BorderStyle FixedSingle
  • Button1
  • Name btnCalculate
  • Text Calculate Gross Pay
  • Button2
  • Name btnExit
  • Text Exit

10
Process Event Handling
  • btnCalculate
  • Button Click Event
  • Assignment statement
  • Gets the data from the text field of the
    txtHoursWorked textbox and the txtPayRate
    textbox.
  • Assign the calculation data from the textboxes
    into the lblGrossPay text field
  • Val changes the text input from the text box into
    a number

11
Event Handling
  • btnExit
  • Button Click Event
  • End

12
Run Test Program
  • Syntax Errors Language Errors
  • Caught by the Compiler Interpreter
  • Visual Basic wavy line under problem code
  • Run-Time Errors
  • Causes Program to Crash
  • Logic Errors
  • Program Runs but gets Wrong Answer

13
Run Test Program
  • Must test for expected and unexpected input

14
Homework
  • Create a Multiplication Tables application.
    The program should allow the user to input 2
    numbers and then display the product of those 2
    numbers. (Remember to use the val function)
Write a Comment
User Comments (0)
About PowerShow.com