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 1992-2004 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 1992-2004 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 3 12.1 Test-Driving the Security Panel Application

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

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

6 © Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 6 12.1 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 7 12.1 Test-Driving the Security Panel Application Entering invalid code – Enter 1212 – Click # Button

8 © Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 8 12.1 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 9 12.1 Test-Driving the Security Panel Application Entering valid code –Enter 1006 –Click # Button

10 © Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 10 12.1 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 11 12.2 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 12 12.2 Introducing the Select Case Multiple- Selection Statement Figure 12.5 Select Case multiple-selection statement UML activity diagram.

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

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

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

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

17 © Copyright 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 17 12.3 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 18 12.3 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 19 12.3 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 20 12.3 Constructing the Security Panel Application Figure 12.10 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 21 12.3 Constructing the Security Panel Application Creating a Case Else statement –Use keywords Case Else –Must follow all other Case statements

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

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

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

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

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

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

28 Outline © Copyright 1992-2004 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 1992-2004 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 1992-2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 30 SecurityPanel.vb (3 of 5)

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

32 Outline © Copyright 1992-2004 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