Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing.

Similar presentations


Presentation on theme: "© Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing."— Presentation transcript:

1 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline 12.1 Test-Driving the Security Panel Application 12.2 Introducing the Select Case Multiple-Selection Statement 12.3 Constructing the Security Panel Application 12.4 Wrap-Up

2 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 2 Objectives In this tutorial, you will learn to: –Use the Select Case multiple-selection statement. –Use Case statements. –Use the Is keyword. –Display a date and time. –Use TextBox property PasswordChar.

3 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application

4 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Load the Wage Calculator application –Debug > Start

5 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Figure 12.1 Security Panel application executing. TextBox Output ListBox Keypad

6 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Figure 12.2 Asterisks displayed in Security code: field. An asterisk is displayed for each numeric key pressed

7 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Entering invalid code – Enter 1212 – Click # Button

8 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Figure 12.3 Security Panel displaying Access Denied message. Message indicating that an invalid security code was entered

9 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Entering valid code –Enter 1006 –Click # Button

10 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Test-Driving the Security Panel Application Figure 12.4 Security Panel application confirming a valid security-code entry. Message displayed when a valid security code is entered

11 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Introducing the Select Case Multiple- Selection Statement Select Case statement –Begins with keywords Select Case followed by test expression –Can contain optional Case Else statement –Terminates with keywords End Select

12 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Introducing the Select Case Multiple- Selection Statement Figure 12.5 Select Case multiple-selection statement UML activity diagram.

13 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application

14 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application

15 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure 12.7 Variable declarations for btnEnter_Click. Declaring event handlers variables Declaring variables Clearing the TextBox

16 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Creating Case statement –Specify a range of values using: Keyword Is Comparison operator (in this case, < )

17 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure 12.8 Select Case statement. Creating a Select Case statement Create Select Case statement – Set controlling expression

18 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure 12.9 First Case added to Select Case statement. Is keyword can be used for relational and equality comparisons

19 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Creating a Case statement –Specifying a range of values using: Keyword To –Checking for a specific number –Specifying multiple expressions Use a comma to separate expressions

20 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Cases specified for remaining access codes. To keyword can be used to specify a range of values to test. Comma used to separate multiple expressions in a Case

21 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Creating a Case Else statement –Use keywords Case Else –Must follow all other Case statements

22 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Case Else of the Select Case statement. Case Else statement executes when no other Case matches

23 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Date structure –Stores and displays date and time information –Property Now returns: System time as a Date

24 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Updating the Security Panel applications ListBox.

25 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Event handler btnZero_Click. Appending 0 to the end of a String

26 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Event handlers btnOne_Click and btnTwo_Click. Appending 1 and 2 to the end of a String

27 © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Constructing the Security Panel Application Figure Event handler btnClear_Click defined. Clearing the TextBox

28 Outline © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 28 SecurityPanel.vb (1 of 5) Retrieving access code and clearing TextBox Declaring variables Using a Select Case statement to determine user access level

29 Outline © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 29 SecurityPanel.vb (2 of 5) Appending the numeric Button value to the text stored in the TextBox

30 Outline © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 30 SecurityPanel.vb (3 of 5)

31 Outline © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 31 SecurityPanel.vb (4 of 5)

32 Outline © Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 32 SecurityPanel.vb (5 of 5) Clearing the TextBox


Download ppt "© Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing."

Similar presentations


Ads by Google