Tutorial 14 – Shipping Time Application Using DateTimes and Timers

Slides:



Advertisements
Similar presentations
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Ticket Information Application.
Advertisements

© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing.
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Eight Sub and Function Procedures.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Microsoft Visual Basic: Reloaded Chapter Eight Sub and Function Procedures.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 6 – Car Payment Calculator Application: Introducing.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 9 Car Payment Calculator Application Introducing the Do While...Loop and Do Until...Loop.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Interest Calculator Application Introducing the For...Next Repetition Statements.
1- Date TimePicker 2- Month Calendar 3- User Defined Controls.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Shipping Hub Application Introducing Generic Collections, LINQ, For Each...Next.
Chapter 12: Using Controls. Examining the IDE’s Automatically Generated Code A new Windows Forms project has been started and given the name FormWithALabelAndAButton.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Typing Application Introducing Keyboard Events, Menus, Dialogs and the Dictionary.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 7.1 Test-Driving the Wage Calculator Application.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 27 - Phone Book Application Introducing Multimedia.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Ticket Information Application Introducing Sequential-Access Files.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 6 – Car Payment Calculator Application: Introducing.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Tutorial 9: Sequential Access Files and Printing1 Tutorial 9 Sequential Access Files and Printing.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Microwave Oven Application Building Your Own Classes and Objects.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 20.1 Test-Driving the Shipping Hub Application.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 18 – Student Grades Application Introducing.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 8.1 Test-Driving the Car Payment Calculator.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 10.1 Test-Driving the Interest Calculator.
Controls Part 2. DateTimePicker Control Used for representing Date/Time information and take it as input from user. Date information is automatically.
Programming with Visual C++: Concepts and Projects Chapter 4B: Selection (Tutorial)
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Microsoft Visual Basic 2012 CHAPTER FIVE Decision Structures.
ADVANCED CONTROLS 1Advanced Controls. Objectives 2Advanced Controls In this module, you will learn about SelectionList control ListView and TreeView control.
 2003 Prentice Hall, Inc. All rights reserved. 1 Outline 11.1 Test-Driving the Interest Calculator Application 11.2 Essentials of Counter-Controlled Repetition.
Visual Basic.NET BASICS Lesson 9 Nested If Statements and Radio Buttons.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
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.
Date TimePicker, Month Calendar
14 Shipping Time App Using Dates and Timers
ASP.NET Forms.
Chapter Topics 15.1 Graphical User Interfaces
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
Tutorial 9 - Car Payment Calculator Application Introducing the while Repetition Statement Outline 9.1 Test-Driving the Car Payment Calculator Application.
Graphical User Interface Concepts: Part I
CHAPTER FIVE Decision Structures.
Three Minute Timer Two Minute Timer One Minute Timer
Using Procedures and Exception Handling
CHAPTER FIVE Decision Structures.
Variables and Arithmetic Operations
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
Programming Based on Events
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
Integrating JavaScript and HTML
Tutorial 9 Sequential Access Files and Printing
Additional Topics in VB.NET
Chapter 15: GUI Applications & Event-Driven Programming
Visual C# - GUI and controls - 1
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
CHAPTER FOUR VARIABLES AND CONSTANTS
Presentation transcript:

Tutorial 14 – Shipping Time Application Using DateTimes and Timers Outline 14.1 Test-Driving the Shipping Time Application 14.2 DateTime Variables 14.3 Building the Shipping Time Application: Design Elements 14.4 Creating the Shipping Time Application: Inserting Code 14.5 Wrap-Up

In this tutorial, you will learn to: Objectives In this tutorial, you will learn to: Create and manipulate DateTime variables. Execute code at regular intervals using a Timer control. Retrieve DateTime input with a DateTimePicker control. Group controls using a GroupBox control.

14.1 Test-Driving the Shipping Time Application

14.1 Test-Driving the Shipping Time Application Figure 14.1 Shipping Time application. DateTimePicker with up-down arrows GroupBoxes

14.2 DateTime Variables Keyword new DateTime variable Calls a structure’s constructor Example: DateTime dtmDelivery = new DateTime( 2003, 1, 1, 0, 0, 0 ) Constructors initialize class objects or structure values DateTime variable Stores information about a point in time Contains properties Year, Month, Day, Hour, Minute, and Second

14.2 DateTime Variables Figure 14.2 DateTime constructor arguments.

14.2 DateTime Variables Figure 14.3 DateTime methods that perform various calculations.

14.3 Building the Shipping Time Application: Design Elements

14.3 Building the Shipping Time Application: Design Elements

14.3 Building the Shipping Time Application: Design Elements Figure 14.5 GroupBox controls on the Shipping Time Form. Newly created GroupBox displaying the text Drop Off GroupBoxes Add a second Groupbox to contain drop off time

14.3 Building the Shipping Time Application: Design Elements Figure 14.6 Adding a Label to a GroupBox. Before clicking inside the GroupBox Place a label inside the GroupBox by clicking the Label tab in the Toolbox

14.3 Building the Shipping Time Application: Design Elements Figure 14.7 DateTimePicker control on the Form. DateTimePicker control before modification (note that the appearance is similar to a ComboBox) Add a DateTimePicker to the application by clicking the DateTimePicker control in the Toolbox

14.3 Building the Shipping Time Application: Design Elements Figure 14.8 Customized DateTimePicker control on the Form. Up-down arrows for DateTimePicker (note that the appearance is similar to a NumericUpDown control) Set ShowUpDown property to true

14.3 Building the Shipping Time Application: Design Elements Figure 14.9 Timer control is displayed in the component tray. Component tray Timer control

14.3 Building the Shipping Time Application: Design Elements Figure 14.10 Rearranging and commenting the control declarations.

14.4 Creating the Shipping Time Application: Inserting Code Tick event handler DateTime property Now retrieves current time Format output hh:mm:ss tt

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.11 Inserting code for a Tick event. Printing the current time

14.4 Creating the Shipping Time Application: Inserting Code Load event handler Date stored in dtmCurrentTime FrmShippingTime_Load event handler MinDate: earliest date allowed MaxDate: latest date allowed

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.12 Storing the current time. Storing the current time in dtmCurrentTime

14.4 Creating the Shipping Time Application: Inserting Code MinDate property Earliest value user can enter Set to 12:00 AM MaxDate property Latest value user can enter Seafood must remain fresh, so value will be set to one day after MinDate

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.13 Setting the MinDate and MaxDate properties. Setting the range of drop-off times

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.14 Calling the DisplayDeliveryTime method. Displaying the delivery time

14.4 Creating the Shipping Time Application: Inserting Code Need to allow user to select a date Application will calculate delivery time ValueChanged event handler

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.15  Inserting code in the ValueChanged event handler. Calculating and displaying the delivery time

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.16 Calling the DepartureTime method. Determining the departure time Calculating the travel time Displaying the delivery time

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.17  Inserting method DepartureTime into the application. Declaring variables

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.18 Determining the seafood shipment’s flight departure time. Using the hour value stored in the DateTimePicker to determine departure time Noon departure time Noon (the next day) departure time Midnight departure time

14.4 Creating the Shipping Time Application: Inserting Code Figure 14.19 Returning the flight departure time. Returning the departure time

ShippingTime.cs (1 of 7)

ShippingTime.cs (2 of 7)

ShippingTime.cs (3 of 7)

ShippingTime.cs (4 of 7) Displaying the current time Setting the DateTimePicker’s minimum and maximum values

ShippingTime.cs (5 of 7) Calculating and displaying the delivery time in Las Vegas

ShippingTime.cs (6 of 7) Using a switch statement to determine departure time

ShippingTime.cs (7 of 7)