1 / 14

Visual Basic Application

Visual Basic Application. 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. Problem Solving. Input (controls): Hours Worked Hourly Pay Rate Process (event handling): Calculate Gross Pay

bpepper
Download Presentation

Visual Basic Application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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

  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: <blank> • Textbox2 • Name: txtPayRate • Text: <blank> • Label4 • Name: lblGrossPay (needs name because will will use this label) • Text: <blank> • Autosize: Off • BorderStyle: FixedSingle • Button1 • Name: btnCalculate • Text: “&Calculate Gross Pay” • Button2 • Name: btnExit • Text: “E&xit”

  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)

More Related