InvEasy (Project1) Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 5- 1 STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Advertisements

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
30/04/ Selection Nested If structures & Complex Multiple Conditions.
Table of Contents III: Use fields to create a TOC and create multiple TOCs Create a TOC by using fields Beyond the three basic methods of building a TOC.
Right-click on the colored box and remove it.
Write a program that allows a user to enter information relating to the name and salary details of an employee The user should be able to enter the name.
Control structures Part 2 iteration control To enable repetition of a statement block.
Promoting Code Reuse Often in programming, multiple procedures will perform the same operation IN OTHER WORDS – the same piece of code will do the same.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
Muffin Shop - if, calculations etc. (muffins, muffins2) Please use speaker notes for additional information!
Savings Account using Class Modules Please use speaker notes for additional information!
2013.  Reconcile your checking account  Create bank reconciliation reports  Find errors during reconciliation  Correct errors found during reconciliation.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Game Design Creating a game called PING Phase 3: Steps for building basic game.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Vanche Gujarat Abhiyaan(VGA)- Best Reader Competition Online Student Registration and Data Entry presentation.
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
MAIL MERGE Designing Documents with. Terms Mail Merge: A process that inserts variable information into a standardized document to produce a personalized.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Break Processing Please use speaker notes for additional information!
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
MIS 3200 – Unit 4.2 ListItem controls – CheckBoxList – ListBox.
Copyright © 2001 by Wiley. All rights reserved. Chapter 5: The Repetition Process in Visual Basic Event Driven Loops Determinate Loops Indeterminate Loops.
The Repetition Process in Visual Basic. The Repetition Process The capability to repeat one or more statements as many times as necessary is what really.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Array - adding to array at run time Please see speaker notes for additional information!
New Project in Visual Basic Please use speaker notes for additional information!
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Random Files Please see speaker notes for additional information!
Your text here Agenda. Topic One Statement Topic Two Statement Topic Three Statement Topic Four Statement.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Class Average Application Introducing the Do...Loop While and Do...Loop Until.
Notes on ADO from other projects Please use speaker notes for additional information!
Two Forms Please use speaker notes for additional information!
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
VAT Calculator program Controls Properties Code Results.
Pay Example (PFirst98) Please use speaker notes for additional information!
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
Maximum Profit Please use speaker notes for additional information!
Lesson 1. Security At the menu bar at the top you will see the word Tools. Click your mouse on Tools scroll down to Macro. Move the Mouse over and down.
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
Using a Database Access97 Please use speaker notes for additional information!
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
CSD 340 (Blum)1 Introducing Text Input elements and Ifs.
Chapter 15: Sub Procedures and Function Procedures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Bank Reconciliation Chapter 4. PAGE REF #CHAPTER 4: Bank Reconciliation SLIDE # 2 Objectives Reconcile your checking Create bank reconciliation reports.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
Multiple forms - SDI & MDI Please use speaker notes for additional information!
Visual Basic - Break Processing
Processing multiple files
A B C D E F G H U T S R Q P O N I J K L M Z Y X W V 6 Reset scores
Word 2002 Chapter 7 MANIPULATING TABS.
Please use speaker notes for additional information!
Event Driven Programming
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Department Array in Visual Basic
Welcome with Ifs CSC 230 (Blum).
If statements (Inven1, Inven2, Inven2a, Inven3, Inven3a)
Please use speaker notes for additional information!
Using screens and adding two numbers - addda.cbl
YOUR text YOUR text YOUR text YOUR text
With Animation 2. The Second Wave 1. The First Wave 3. The Third Wave.
This is the Title of the Presentation
CHAPTER FOUR VARIABLES AND CONSTANTS
Presentation transcript:

InvEasy (Project1) Please use speaker notes for additional information!

InvEasy - Project1

Defining variables that can be used in all subroutines.

InvEasy - Project 1

Private Sub cmdAdd_Click() If optS1.Value = True Then wrkTotal1 = wrkTotal1 + Val(txtNumRec.Text) Else If optS2.Value = True Then wrkTotal2 = wrkTotal2 + Val(txtNumRec.Text) Else If optS3.Value = True Then wrkTotal3 = wrkTotal3 + Val(txtNumRec.Text) Else If optS4.Value = True Then wrkTotal4 = wrkTotal4 + Val(txtNumRec.Text) Else wrkResponse = MsgBox("Please select Style", 0, "Select Style") End If txtNumRec.Text = "" txtNumRec.SetFocus optS5.SetFocus End Sub wrkTotal1, wrkTotal2, wrkTotal3 and wrkTotal4 were defined as String in the general area so they are available in all routines. Note also that wrkTotal1 is used when optS1 is selected and wrkTotal2 is used when optS2 is selected etc. In previous examples, I used vbOkOnly in place of the 0 here. The accomplish the same thing. txtNumRec is set to null which clears it out and it receives the focus which means that the cursor is set to this field. optS5 receives the focus and that means that it is the selected option. In fact, the txtNumRec.SetFocus is here just to show the code, it is overridden by the SetFocus statement beneath it. I actually handled the SetFocus in a different routine as you will see on later slides. To accumulate a total, add the number to the accumulator and put the results back in the accumulator.

InvEasy - Project1

Private Sub cmdSum_Click() txtS1.Text = Format(wrkTotal1, "###0") txtS2.Text = Format(wrkTotal2, "###0") txtS3.Text = Format(wrkTotal3, "###0") txtS4.Text = Format(wrkTotal4, "###0") txtNumRec.SetFocus End Sub When the Sum button is clicked, the sums that have been accumulated in the wrkTotal1 etc. accumulators are moved to the corresponding text boxes on the form. The formatting that is used suppresses leading zeros. In this example, I clicked style 1 and entered 23. Then I clicked AddReceipt. Next,I clicked style2 and entered 45. Then I clicked AddReceipt. Finally, I clicked style1 again and entered 12. Then I clicked AddReceipt. Now I wanted to see the totals so I clicked Sum and the code displayed the accumulated total for style1 which was , and the accumulated total for style2 which was the 45 that I entered. Since I entered no data for style3 or style4, 0 was displayed for these totals.

InvEasy - Project1 Private Sub Form_Load() wrkTotal1 = 0 wrkTotal2 = 0 wrkTotal3 = 0 wrkTotal4 = 0 End Sub This code uses the Form_Load event which execute the Form_Load event procedure which initializes the four accumulators that were declared in the General - Declaratives area. The initialization is to set each of the accumulators to 0.

InvEasy - Project1 Private Sub optS1_Click() txtNumRec.SetFocus End Sub Private Sub optS2_Click() txtNumRec.SetFocus End Sub Private Sub optS3_Click() txtNumRec.SetFocus End Sub Private Sub optS4_Click() txtNumRec.SetFocus End Sub This the code that actually moves the focus to txtNumRec after one of the options has been clicked. It is a click event of the option button. When the option button is clicked the named click event procedure is executed. The sole function of the event procedure is to set the focus on the txtNumRec.

Style 1 is selected and 3 is entered for the number received. The AddReceipt button is clicked. Style 2 is selected and 12 is entered for the number received.

The AddReceipt button is clicked. Style 1 is selected again and 24 is entered as the number received. The AddReceipt button is clicked to add to the accumulator and reset. Style 4 is selected and 100 is entered as the number received. The AddReceipt button is clicked to add to the accumulator and reset.

Style 3 is selected and 50 is entered as the number received. The AddReceipt button is clicked to add to the accumulator and reset. Style 2is selected and 10 is entered as the number received. The AddReceipt button is clicked to add to the accumulator and reset. Sum is pressed and the result for each style is displayed. Style 1 has 3 and 24 which makes 27. Style 2 has 12 and 10 which makes 22. Style 3 has 50 and style 4 has 100.

InvEasy - ProjInv1

These 4 pictures of the form show the collection of data. After each data entry, the AddReceipt button was clicked. When the Sum button is clicked, the accumulated totals are shown.

InvEasy - ProjInv2

In the first example, 12 was entered in # Received and AddReceipt was clicked. # Received is cleared and the amount shows in the Total Results for style 1. In the second example, the same processing puts 25 in Total Results for style 3. In the third example, 100 was entered for style 1 which increased style 1 to 112 and in the fourth example, 15 was added for style 3. Reset clears the totals but leaves the last style selection in place.