Tải bản đầy đủ (.pdf) (1,565 trang)

visual basic net how to program 2e

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (16.11 MB, 1,565 trang )

Contents
Contents vii
Illustrations xxviii
Preface xxxvii
1 Introduction to Computers, Internet and
Visual Basic .NET 1
1.1 Introduction 2
1.2 What Is a Computer? 3
1.3 Computer Organization 4
1.4 Evolution of Operating Systems 5
1.5 Personal Computing, Distributed Computing and Client/Server Computing 5
1.6 Machine Languages, Assembly Languages and High-Level Languages 6
1.7 Visual Basic .NET 7
1.8 C, C++, Java™ and C# 9
1.9 Other High-Level Languages 10
1.10 Structured Programming 10
1.11 Key Software Trend: Object Technology 11
1.12 Hardware Trends 13
1.13 History of the Internet and World Wide Web 14
1.14 World Wide Web Consortium (W3C) 15
1.15 Extensible Markup Language (XML) 16
1.16 Introduction to Microsoft .NET 17
1.17 .NET Framework and the Common Language Runtime 18
1.18 Tour of the Book 20
1.19 Internet and World Wide Web Resources 29
VIII
2 Introduction to the Visual Studio .NET IDE 33
2.1 Introduction 34
2.2 Overview of the Visual Studio .NET IDE 34
2.3 Menu Bar and Toolbar 37
2.4 Visual Studio .NET IDE Windows 39


2.4.1 Solution Explorer 40
2.4.2 Toolbox 41
2.4.3 Properties Window 41
2.5 Using Help 44
2.6 Simple Program: Displaying Text and an Image 45
2.7 Internet and World Wide Web Resources 55
3 Introduction to Visual Basic Programming 61
3.1 Introduction 62
3.2 Simple Program: Printing a Line of Text 62
3.3 Another Simple Program: Adding Integers 70
3.4 Memory Concepts 73
3.5 Arithmetic 74
3.6 Decision Making: Equality and Relational Operators 78
3.7 Using a Dialog to Display a Message 82
3.8 Internet and World Wide Web Resources 88
4 Control Structures: Part 1 96
4.1 Introduction 97
4.2 Algorithms 97
4.3 Pseudocode 98
4.4 Control Structures 98
4.5 If/Then Selection Structure 102
4.6 If/Then/Else Selection Structure 104
4.7 While Repetition Structure 106
4.8 Do While/Loop Repetition Structure 108
4.9 Do Until/Loop Repetition Structure 109
4.10 Assignment Operators 110
4.11 Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition) 112
4.12 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 2
(Sentinel-Controlled Repetition) 114
4.13 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 3

(Nested Control Structures) 119
4.14 Formulating Algorithms with Top-Down, Stepwise Refinement: Case Study 4
(Nested Repetition Structures) 123
4.15 Introduction to Windows Application Programming 127
5 Control Structures: Part 2 144
5.1 Introduction 145
5.2 Essentials of Counter-Controlled Repetition 145
5.3 For/Next Repetition Structure 146
5.4 Examples Using the For/Next Structure 149
IX
5.5 Select Case Multiple-Selection Structure 155
5.6 Do/Loop While Repetition Structure 159
5.7 Do/Loop Until Repetition Structure 160
5.8 Using the Exit Keyword in a Repetition Structure 162
5.9 Logical Operators 164
5.10 Structured Programming Summary 170
6 Procedures 182
6.1 Introduction 183
6.2 Modules, Classes and Procedures 183
6.3 Sub Procedures 185
6.4 Function Procedures 188
6.5 Methods 190
6.6 Argument Promotion 195
6.7 Option Strict and Data-Type Conversions 196
6.8 Value Types and Reference Types 198
6.9 Passing Arguments: Pass-by-Value vs. Pass-by-Reference 200
6.10 Duration of Identifiers 202
6.11 Scope Rules 203
6.12 Random-Number Generation 206
6.13 Example: Game of Chance 213

6.14 Recursion 218
6.15 Example Using Recursion: Fibonacci Series 221
6.16 Recursion vs. Iteration 225
6.17 Procedure Overloading and Optional Arguments 226
6.17.1 Procedure Overloading 226
6.17.2 Optional Arguments 228
6.18 Modules 231
7 Arrays 245
7.1 Introduction 246
7.2 Arrays 246
7.3 Declaring and Allocating Arrays 248
7.4 Examples Using Arrays 249
7.4.1 Allocating an Array 250
7.4.2 Initializing the Values in an Array 251
7.4.3 Summing the Elements of an Array 252
7.4.4 Using Arrays to Analyze Survey Results 253
7.4.5 Using Histograms to Display Array Data Graphically 256
7.5 Passing Arrays to Procedures 260
7.6 Passing Arrays: ByVal vs. ByRef 264
7.7 Sorting Arrays 268
7.8 Searching Arrays: Linear Search and Binary Search 272
7.8.1 Searching an Array with Linear Search 272
7.8.2 Searching a Sorted Array with Binary Search 275
7.9 Multidimensional Rectangular and Jagged Arrays 279
X
7.10 Variable-Length Parameter Lists 287
7.11 For Each/Next Repetition Structure 288
8 Object-Based Programming 296
8.1 Introduction 297
8.2 Implementing a Time Abstract Data Type with a Class 298

8.3 Class Scope 306
8.4 Controlling Access to Members 306
8.5 Initializing Class Objects: Constructors 308
8.6 Using Overloaded Constructors 308
8.7 Properties 314
8.8 Composition: Objects as Instance Variables of Other Classes 321
8.9 Using the Me Reference 324
8.10 Garbage Collection 326
8.11 Shared Class Members 327
8.12 Const and ReadOnly Members 331
8.13 Data Abstraction and Information Hiding 334
8.14 Software Reusability 335
8.15 Namespaces and Assemblies 336
8.16 Class View and Object Browser 340
9 Object-Oriented Programming: Inheritance 349
9.1 Introduction 350
9.2 Base Classes and Derived Classes 351
9.3 Protected and Friend Members 354
9.4 Relationship between Base Classes and Derived Classes 354
9.5 Case Study: Three-Level Inheritance Hierarchy 372
9.6 Constructors and Finalizers in Derived Classes 376
9.7 Software Engineering with Inheritance 382
10 Object-Oriented Programming: Polymorphism 388
10.1 Introduction 389
10.2 Derived-Class-Object to Base-Class-Object Conversion 389
10.3 Type Fields and Select Case Statements 396
10.4 Polymorphism Examples 397
10.5 Abstract Classes and Methods 398
10.6 Case Study: Inheriting Interface and Implementation 400
10.7 NotInheritable Classes and NotOverridable Methods 408

10.8 Case Study: Payroll System Using Polymorphism 409
10.9 Case Study: Creating and Using Interfaces 419
10.10 Delegates 432
11 Exception Handling 441
11.1 Introduction 442
11.2 Exception Handling Overview 443
11.3 Example: DivideByZeroException 446
11.4 .NET Exception Hierarchy 450
XI
11.5 Finally Block 452
11.6 Exception Properties 459
11.7 Programmer-Defined Exception Classes 464
11.8 Handling Overflows 468
12 Graphical User Interface Concepts: Part 1 475
12.1 Introduction 476
12.2 Windows Forms 478
12.3 Event-Handling Model 480
12.4 Control Properties and Layout 487
12.5 Labels, TextBoxes and Buttons491
12.6 GroupBoxes and Panels494
12.7 CheckBoxes and RadioButtons497
12.8 PictureBoxes 508
12.9 Mouse-Event Handling 510
12.10 Keyboard-Event Handling 513
13 Graphical User Interfaces Concepts: Part 2 523
13.1 Introduction 524
13.2 Menus 524
13.3 LinkLabels534
13.4 ListBoxes and CheckedListBoxes 538
13.4.1 ListBoxes 540

13.4.2 CheckedListBoxes 542
13.5 ComboBoxes 545
13.6 TreeViews550
13.7 ListViews555
13.8 Tab Control 562
13.9 Multiple-Document-Interface (MDI) Windows 567
13.10 Visual Inheritance 576
13.11 User-Defined Controls 580
14 Multithreading 592
14.1 Introduction 593
14.2 Thread States: Life Cycle of a Thread 595
14.3 Thread Priorities and Thread Scheduling 596
14.4 Thread Synchronization and Class Monitor 601
14.5 Producer/Consumer Relationship without Thread Synchronization 603
14.6 Producer/Consumer Relationship with Thread Synchronization 609
14.7 Producer/Consumer Relationship: Circular Buffer 618
15 Strings, Characters and Regular Expressions 633
15.1 Introduction 634
15.2 Fundamentals of Characters and Strings 634
15.3 String Constructors 635
15.4 String Length and Chars Properties, and CopyTo Method 637
15.5 Comparing Strings639
XII
15.6 String Method GetHashCode 643
15.7 Locating Characters and Substrings in Strings644
15.8 Extracting Substrings from Strings647
15.9 Concatenating Strings648
15.10 Miscellaneous String Methods 649
15.11 Class StringBuilder 651
15.12 StringBuilder Indexer, Length and Capacity Properties,

and EnsureCapacity Method 652
15.13 StringBuilder Append and AppendFormat Methods 654
15.14 StringBuilder Insert, Remove and Replace Methods 657
15.15 Char Methods 660
15.16 Card Shuffling and Dealing Simulation 663
15.17 Regular Expressions and Class Regex 667
16 Graphics and Multimedia 683
16.1 Introduction 684
16.2 Graphics Contexts and Graphics Objects 686
16.3 Color Control 687
16.4 Font Control 694
16.5 Drawing Lines, Rectangles and Ovals 699
16.6 Drawing Arcs 702
16.7 Drawing Polygons and Polylines 705
16.8 Advanced Graphics Capabilities 709
16.9 Introduction to Multimedia 714
16.10 Loading, Displaying and Scaling Images 714
16.11 Animating a Series of Images 716
16.12 Windows Media Player 729
16.13 Microsoft Agent 731
17 Files and Streams 752
17.1 Introduction 753
17.2 Data Hierarchy 753
17.3 Files and Streams 755
17.4 Classes File and Directory 757
17.5 Creating a Sequential-Access File 767
17.6 Reading Data from a Sequential-Access File 778
17.7 Random-Access Files 789
17.8 Creating a Random-Access File 794
17.9 Writing Data Randomly to a Random-Access File 797

17.10 Reading Data Sequentially from a Random-Access File 802
17.11 Case Study: A Transaction-Processing Program 807
18 Extensible Markup Language (XML) 833
18.1 Introduction 834
18.2 XML Documents 834
18.3 XML Namespaces 839
18.4 Document Object Model (DOM) 842
XIII
18.5 Document Type Definitions (DTDs), Schemas and Validation 860
18.5.1 Document Type Definitions 861
18.5.2 Microsoft XML Schemas 865
18.6 Extensible Stylesheet Language and XslTransform 870
18.7 Microsoft BizTalk™ 877
18.8 Internet and World Wide Web Resources 880
19 Database, SQL and ADO .NET 887
19.1 Introduction 888
19.2 Relational Database Model 889
19.3 Relational Database Overview: Books Database 890
19.4 Structured Query Language (SQL) 896
19.4.1 Basic SELECT Query 897
19.4.2 WHERE Clause 898
19.4.3 ORDER BY Clause 901
19.4.4 Merging Data from Multiple Tables: INNER JOIN 903
19.4.5 Joining Data from Tables Authors, AuthorISBN,
Titles and Publishers 906
19.4.6 INSERT Statement 909
19.4.7 UPDATE Statement 910
19.4.8 DELETE Statement 911
19.5 ADO .NET Object Model 912
19.6 Programming with ADO .NET: Extracting Information from a DBMS 913

19.6.1 Connecting to and Querying an Access Data Source 913
19.6.2 Querying the Books Database 921
19.7 Programming with ADO .NET: Modifying a DBMS 923
19.8 Reading and Writing XML Files 932
20 ASP .NET, Web Forms and Web Controls 941
20.1 Introduction 942
20.2 Simple HTTP Transaction 943
20.3 System Architecture 945
20.4 Creating and Running a Simple Web-Form Example 946
20.5 Web Controls 958
20.5.1 Text and Graphics Controls 958
20.5.2 AdRotator Control 964
20.5.3 Validation Controls 969
20.6 Session Tracking 979
20.6.1 Cookies 980
20.6.2 Session Tracking with HttpSessionState 989
20.7 Case Study: Online Guest book 998
20.8 Case Study: Connecting to a Database in ASP .NET 1004
20.9 Tracing 1019
20.10 Internet and World Wide Web Resources 1021
21 ASP .NET and Web Services 1030
21.1 Introduction 1031
XIV
21.2 Web Services 1032
21.3 Simple Object Access Protocol (SOAP) and Web Services 1036
21.4 Publishing and Consuming Web Services 1037
21.5 Session Tracking in Web Services 1053
21.6 Using Web Forms and Web Services 1066
21.7 Case Study: Temperature Information Application 1072
21.8 User-Defined Types in Web Services 1081

21.9 Internet and World Wide Web Resources 1091
22 Networking: Streams-Based Sockets
and Datagrams 1096
22.1 Introduction 1097
22.2 Establishing a Simple Server (Using Stream Sockets) 1098
22.3 Establishing a Simple Client (Using Stream Sockets) 1100
22.4 Client/Server Interaction via Stream-Socket Connections 1101
22.5 Connectionless Client/Server Interaction via Datagrams 1110
22.6 Client/Server Tic-Tac-Toe Using a Multithreaded Server 1116
23 Data Structures and Collections 1136
23.1 Introduction 1137
23.2 Self-Referential Classes 1137
23.3 Linked Lists 1139
23.4 Stacks 1152
23.5 Queues 1156
23.6 Trees 1160
23.6.1 Binary Search Tree of Integer Values 1161
23.6.2 Binary Search Tree of IComparable Objects 1168
23.7 Collection Classes 1175
23.7.1 Class Array 1176
23.7.2 Class ArrayList 1179
23.7.3 Class Stack 1185
23.7.4 Class Hashtable 1189
24 Accessibility 1203
24.1 Introduction 1204
24.2 Regulations and Resources 1205
24.3 Web Accessibility Initiative 1207
24.4 Providing Alternatives for Images 1208
24.5 Maximizing Readability by Focusing on Structure 1209
24.6 Accessibility in Visual Studio .NET 1209

24.6.1 Enlarging Toolbar Icons 1210
24.6.2 Enlarging the Text 1211
24.6.3 Modifying the Toolbox 1212
24.6.4 Modifying the Keyboard 1213
24.6.5 Rearranging Windows 1214
24.7 Accessibility in Visual Basic 1215
24.8 Accessibility in XHTML Tables 1221
XV
24.9 Accessibility in XHTML Frames 1225
24.10 Accessibility in XML 1226
24.11 Using Voice Synthesis and Recognition with VoiceXML™ 1226
24.12 CallXML™ 1233
24.13 JAWS® for Windows 1240
24.14 Other Accessibility Tools 1240
24.15 Accessibility in Microsoft® Windows® 2000 1241
24.15.1 Tools for People with Visual Impairments 1243
24.15.2 Tools for People with Hearing Impairments 1246
24.15.3 Tools for Users Who Have Difficulty Using the Keyboard 1247
24.15.4 Microsoft Narrator 1251
24.15.5 Microsoft On-Screen Keyboard 1252
24.15.6 Accessibility Features in Microsoft Internet Explorer 5.5 1253
24.16 Internet and World Wide Web Resources 1255
A Operator Precedence Chart 1264
B Number Systems (on CD) 1266
B.1 Introduction 1267
B.2 Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers 1270
B.3 Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers 1272
B.4 Converting from Binary, Octal or Hexadecimal to Decimal 1272
B.5 Converting from Decimal to Binary, Octal, or Hexadecimal 1273
B.6 Negative Binary Numbers: Two’s Complement Notation 1274

C Career Opportunities (on CD) 1280
C.1 Introduction 1281
C.2 Resources for the Job Seeker 1282
C.3 Online Opportunities for Employers 1283
C.3.1 Posting Jobs Online 1285
C.3.2 Problems with Recruiting on the Web 1287
C.3.3 Diversity in the Workplace 1287
C.4 Recruiting Services 1288
C.5 Career Sites 1289
C.5.1 Comprehensive Career Sites 1289
C.5.2 Technical Positions 1290
C.5.3 Wireless Positions 1290
C.5.4 Contracting Online 1291
C.5.5 Executive Positions 1292
C.5.6 Students and Young Professionals 1293
C.5.7 Other Online Career Services 1293
C.6 Internet and World Wide Web Resources 1294
D Visual Studio .NET Debugger 1302
D.1 Introduction 1303
D.2 Breakpoints 1304
D.3 Examining Data 1306
XVI
D.4 Program Control 1308
D.5 Additional Procedure Debugging Capabilities 1312
D.6 Additional Class Debugging Capabilities 1314
E ASCII Character Set 1319
F Unicode
®
(on CD) 1320
F.1 Introduction 1321

F.2 Unicode Transformation Formats 1322
F.3 Characters and Glyphs 1323
F.4 Advantages/Disadvantages of Unicode 1324
F.5 Unicode Consortium’s Web Site 1324
F.6 Using Unicode 1325
F.7 Character Ranges 1327
G COM Integration (on CD) 1332
G.1 Introduction 1332
G.2 ActiveX Integration 1333
G.3 DLL Integration 1337
G.4 Internet and World Wide Web Resources 1341
H Introduction to HyperText Markup
Language 4: Part 1 (on CD) 1344
H.1 Introduction 1345
H.2 Markup Languages 1345
H.3 Editing HTML 1346
H.4 Common Elements 1346
H.5 Headers 1349
H.6 Linking 1350
H.7 Images 1352
H.8 Special Characters and More Line Breaks 1356
H.9 Unordered Lists 1358
H.10 Nested and Ordered Lists 1359
H.11 Internet and World Wide Web Resources 1362
I Introduction to HyperText Markup
Language 4: Part 2 (on CD) 1367
I.1 Introduction 1368
I.2 Basic HTML Tables 1368
I.3 Intermediate HTML Tables and Formatting 1370
I.4 Basic HTML Forms 1373

I.5 More Complex HTML Forms 1376
I.6 Internal Linking 1383
I.7 Creating and Using Image Maps 1386
I.8 <meta> Tags 1388
I.9 frameset Element 1390
XVII
I.10 Nested framesets 1392
I.11 Internet and World Wide Web Resources 1394
J Introduction to XHTML: Part 1 (on CD) 1400
J.1 Introduction 1401
J.2 Editing XHTML 1401
J.3 First XHTML Example 1402
J.4 W3C XHTML Validation Service 1405
J.5 Headers 1406
J.6 Linking 1408
J.7 Images 1411
J.8 Special Characters and More Line Breaks 1415
J.9 Unordered Lists 1417
J.10 Nested and Ordered Lists 1418
J.11 Internet and World Wide Web Resources 1421
K Introduction to XHTML: Part 2 (on CD) 1426
K.1 Introduction 1427
K.2 Basic XHTML Tables 1427
K.3 Intermediate XHTML Tables and Formatting 1430
K.4 Basic XHTML Forms 1432
K.5 More Complex XHTML Forms 1435
K.6 Internal Linking 1443
K.7 Creating and Using Image Maps 1446
K.8 meta Elements 1448
K.9 frameset Element 1449

K.10 Nested framesets 1454
K.11 Internet and World Wide Web Resources 1456
L HTML/XHTML Special Characters 1462
M HTML/XHTML Colors 1463
N Crystal Reports® for Visual Studio .NET 1466
N.1 Introduction 1466
N.2 Crystal Reports Web Site Resources 1466
N.3 Crystal Reports and Visual Studio .NET 1467
N.3.1 Crystal Reports in Web Applications 1469
N.3.2 Crystal Reports and Web Services 1469
Bibliography 1471
Index 1475
Illustrations
1 Introduction to Computers, Internet and Visual Basic .NET
1.1 .NET Languages. 19
2 Introduction to the Visual Studio .NET IDE
2.1 Start Page in Visual Studio .NET. 35
2.2 New Project dialog. 36
2.3 Design view of Visual Studio .NET IDE. 37
2.4 Visual Studio .NET IDE menu bar. 38
2.5 Summary of Visual Studio .NET IDE menus. 38
2.6 IDE Toolbar. 38
2.7 Tool tip demonstration. 39
2.8 Toolbar icons for three Visual Studio .NET IDE windows. 39
2.9 Auto-hide feature demonstration. 40
2.10 Solution Explorer with an open solution. 41
2.11 Toolbox window. 42
2.12 Properties window. 43
2.13 Help menu commands. 44
2.14 Dynamic Help window. 44

2.15 Simple program executing. 45
2.16 Creating a new Windows Application.46
2.17 Setting the project location in the Project Location dialog. 47
2.18 Setting the form’s Text property. 47
2.19 Form with sizing handles.48
2.20 Changing the form’s BackColor property. 48
2.21 Adding a label to the form. 49
2.22 GUI after the form and label have been customized. 50
2.23 Properties window displaying the label’s properties. 50
2.24 Font dialog for selecting fonts, styles and sizes. 51
Illustrations XIX
2.25 Centering the label’s text. 51
2.26 Inserting and aligning the picture box. 52
2.27 Image property of the picture box. 52
2.28 Selecting an image for the picture box. 53
2.29 Picture box displaying an image. 53
2.30 IDE in run mode, with the running application in the foreground. 54
3 Introduction to Visual Basic Programming
3.1 Simple Visual Basic program. 63
3.2 Creating a Console Application with the New Project dialog. 65
3.3 IDE with an open console application. 66
3.4 Renaming the program file in the Properties window. 66
3.5 IntelliSense feature of the Visual Studio .NET IDE. 68
3.6 Parameter Info and Parameter List windows. 68
3.7 Executing the program shown in Fig. 3.1. 68
3.8 IDE indicating a syntax error. 69
3.9 Using multiple statements to print a line of text. 69
3.10 Addition program that adds two numbers entered by the user. 70
3.11 Dialog displaying a run-time error. 72
3.12 Memory location showing name and value of variable number1.74

3.13 Memory locations after values for variables number1 and number2
have been input. 74
3.14 Memory locations after an addition operation. 74
3.15 Arithmetic operators. 75
3.16 Precedence of arithmetic operators. 76
3.17 Order in which a second-degree polynomial is evaluated. 79
3.18 Equality and relational operators. 79
3.19 Performing comparisons with equality and relational operators. 80
3.20 Precedence and associativity of operators introduced in this chapter. 82
3.21 Displaying text in a dialog. 83
3.22 Dialog displayed by calling MessageBox.Show.85
3.23 Obtaining documentation for a class by using the Index dialog. 85
3.24 Documentation for the MessageBox class. 85
3.25 Adding a reference to an assembly in the Visual Studio .NET IDE. 86
3.26 Internet Explorer window with GUI components. 87
4 Control Structures: Part 1
4.1 Sequence structure flowchart. 100
4.2 Keywords in Visual Basic. 101
4.3 If/Then single-selection structure flowchart. 103
4.4 If/Then/Else double-selection structure flowchart. 105
4.5 While repetition structure used to print powers of two. 107
4.6 While repetition structure flowchart. 107
4.7 Do While/Loop repetition structure demonstration. 108
4.8 Do While/Loop repetition structure flowchart. 109
4.9 Do Until/Loop repetition structure demonstration. 109
XX Illustrations
4.10 Do Until/Loop repetition structure flowchart. 110
4.11 Assignment operators. 111
4.12 Exponentiation using an assignment operator. 111
4.13 Pseudocode algorithm that uses counter-controlled repetition to

solve the class-average problem. 112
4.14 Class-average program with counter-controlled repetition. 112
4.15 Pseudocode algorithm that uses sentinel-controlled repetition to
solve the class-average problem. 116
4.16 Class-average program with sentinel-controlled repetition. 117
4.17 Pseudocode for examination-results problem. 122
4.18 Nested control structures used to calculate examination results. 122
4.19 Second refinement of the pseudocode. 126
4.20 Nested repetition structures used to print a square of *s. 126
4.21 IDE showing program code for Fig. 2.15. 129
4.22 Windows Form Designer generated code when expanded. 130
4.23 Code generated by the IDE for lblWelcome.130
4.24 Properties window used to set a property value. 131
4.25 Windows Form Designer generated code reflecting new property values. 132
4.26 Changing a property in the code view editor. 132
4.27 New Text property value reflected in design mode. 132
4.28 Adding program code to FrmASimpleProgram_Load.133
4.29 Method FrmASimpleProgram_Load containing program code. 134
4.30 Changing a property value at runtime. 134
5 Control Structures: Part 2
5.1 Counter-controlled repetition with the While structure. 146
5.2 Counter-controlled repetition with the For/Next structure. 146
5.3 For/Next header components. 148
5.4 For/Next repetition structure flowchart. 149
5.5 For/Next structure used for summation. 150
5.6 Message dialog icon constants. 151
5.7 Message dialog button constants. 151
5.8 For/Next structure used to calculate compound interest. 152
5.9 Formatting codes for Strings. 154
5.10 Select Case structure used to count grades. 155

5.11 Select Case multiple-selection structure flowchart. 158
5.12 Do/Loop While repetition structure. 159
5.13 Do/Loop While repetition structure flowchart. 160
5.14 Do/Loop Until repetition structure. 160
5.15 Do/Loop Until repetition structure flowchart. 161
5.16 Exit keyword in repetition structures. 162
5.17 Truth table for the AndAlso operator. 165
5.18 Truth table for the OrElse operator. 166
5.19 Truth table for the logical exclusive OR (Xor) operator. 167
5.20 Truth table for operator Not (logical NOT). 167
5.21 Logical operator truth tables. 168
Illustrations XXI
5.22 Precedence and associativity of the operators discussed so far. 169
5.23 Visual Basic’s single-entry/single-exit sequence and selection structures. 170
5.24 Visual Basic’s single-entry/single-exit repetition structures. 171
5.25 Structured programming rules. 172
5.26 Simplest flowchart. 173
5.27 Repeatedly applying rule 2 of Fig. 5.25 to the simplest flowchart. 173
5.28 Applying rule 3 of Fig. 5.25 to the simplest flowchart. 174
5.29 Stacked, nested and overlapped building blocks. 175
5.30 Unstructured flowchart. 175
6 Procedures
6.1 Hierarchical boss-procedure/worker-procedure relationship. 185
6.2 Sub procedure for printing payment information. 185
6.3 Function procedure for squaring an integer. 188
6.4 Method that determines the largest of three numbers. 190
6.5 Parameter Info feature of the Visual Studio .NET IDE. 193
6.6 IntelliSense feature of the Visual Studio .NET IDE. 193
6.7 Math class methods. 194
6.8 Widening conversions. 196

6.9 Property Pages dialog with Option Strict set to On.197
6.10 Visual Basic primitive data types. 198
6.11 Literals with type characters. 199
6.12 ByVal and ByRef used to pass value-type arguments. 201
6.13 Scoping rules in a class. 204
6.14 Random integers created by calling method Next of class Random.208
6.15 Demonstrates 4 die rolls. 209
6.16 Random class used to simulate rolling 12 six-sided dice. 211
6.17 Craps game using class Random.214
6.18 Recursive evaluation of 5!.219
6.19 Recursive factorial program. 220
6.20 Recursively generating Fibonacci numbers. 222
6.21 Recursive calls to method Fibonacci.224
6.22 Overloaded methods. 226
6.23 Syntax error generated from overloaded procedures with identical
parameter lists and different return types. 228
6.24 Optional argument demonstration with method Power.229
6.25 Module used to define a group of related procedures. 231
6.26 Testing the modDice procedures. 232
6.27 Printing the results of cubing 10 numbers. 238
6.28 Towers of Hanoi for the case with four disks. 244
7 Arrays
7.1 Array consisting of 12 elements. 247
7.2 Creating an array. 250
7.3 Initializing array elements two different ways. 251
7.4 Computing the sum of the elements in an array. 252
7.5 Simple student-poll analysis program. 254
XXII Illustrations
7.6 Program that prints histograms. 256
7.7 Using arrays to eliminate a Select Case structure. 257

7.8 Passing arrays and individual array elements to procedures. 261
7.9 Passing an array reference with ByVal and ByRef.265
7.10 BubbleSort procedure in modBubbleSort.268
7.11 Sorting an array with bubble sort. 269
7.12 Procedures for performing a linear search. 272
7.13 Linear search of an array. 273
7.14 Binary search of a sorted array. 276
7.15 Two-dimensional array with three rows and four columns. 280
7.16 Initializing multidimensional arrays. 281
7.17 Using jagged two-dimensional arrays. 283
7.18 Creating variable-length parameter lists. 287
7.19 Using For Each/Next with an array. 288
8 Object-Based Programming
8.1 Abstract data type representing time in 24-hour format. 299
8.2 Using an abstract data type. 303
8.3 Attempting to access restricted class members results in a syntax error. 307
8.4 Overloading constructors. 309
8.5 Overloaded-constructor demonstration. 312
8.6 Properties in a class. 314
8.7 Graphical user interface for class CTime3. 318
8.8 CDay class encapsulates day, month and year information. 321
8.9 CEmployee class encapsulates employee name, birthday and hire date. 323
8.10 Composition demonstration. 324
8.11 Class using Me reference. 325
8.12 Me reference demonstration. 326
8.13 CEmployee2 class objects share Shared variable. 328
8.14 Shared class member demonstration. 330
8.15 Constants used in class CCircleConstants. 332
8.16 Const and ReadOnly class member demonstration. 333
8.17 CEmployee3 class to store in class library. 336

8.18 Simple class library project. 338
8.19 Module modAssemblyTest references EmployeeLibrary.dll.339
8.20 Class View of Fig. 8.1 and Fig. 8.2. 341
8.21 Invoking the Object Browser from the development environment. 342
8.22 Object Browser when user selects Object from development
environment. 343
9 Object-Oriented Programming: Inheritance
9.1 Inheritance examples. 352
9.2 Inheritance hierarchy for university CCommunityMembers. 353
9.3 Portion of a CShape class hierarchy. 354
9.4 CPoint class represents an x-y coordinate pair. 355
9.5 modPointTest demonstrates class CPoint functionality. 357
Illustrations XXIII
9.6 CCircle class contains an x-y coordinate and a radius. 358
9.7 modCircleTest demonstrates class CCircle functionality. 360
9.8 CCircle2 class that inherits from class CPoint.362
9.9 CPoint2 class represents an x-y coordinate pair as Protected data. 364
9.10 CCircle3 class that inherits from class CPoint2. 365
9.11 modCircleTest3 demonstrates class CCircle3 functionality. 367
9.12 CCircle4 class that inherits from class CPoint, which does not
provide Protected data. 369
9.13 modCircleTest4 demonstrates class CCircle4 functionality. 371
9.14 CCylinder class inherits from class CCircle4 and Overrides
method Area. 373
9.15 Testing class CCylinder. 375
9.16 CPoint3 base class contains constructors and finalizer. 378
9.17 CCircle5 class inherits from class CPoint3 and overrides a
finalizer method. 379
9.18 Demonstrating order in which constructors and finalizers are called. 381
10 Object-Oriented Programming: Polymorphism

10.1 CPoint class represents an x-y coordinate pair. 390
10.2 CCircle class that inherits from class CPoint.391
10.3 Assigning derived-class references to base-class references. 393
10.4 Abstract CShape base class. 400
10.5 CPoint2 class inherits from MustInherit class CShape.401
10.6 CCircle2 class that inherits from class CPoint2.403
10.7 CCylinder2 class inherits from class CCircle2.404
10.8 CTest2 demonstrates polymorphism in Point-Circle-Cylinder hierarchy. 406
10.9 MustInherit class CEmployee definition. 410
10.10 CBoss class inherits from class CEmployee.411
10.11 CCommissionWorker class inherits from class CEmployee.412
10.12 CPieceWorker class inherits from class CEmployee.414
10.13 CHourlyWorker class inherits from class CEmployee.416
10.14 CTest class tests the CEmployee class hierarchy. 417
10.15 Interface for returning age of objects of disparate classes. 420
10.16 CPerson class implements IAge interface. 421
10.17 CTree class implements IAge interface. 422
10.18 Demonstrate polymorphism on objects of disparate classes. 423
10.19 IShape interface provides methods Area and Volume and
property Name.426
10.20 CPoint3 class implements interface IShape.426
10.21 CCircle3 class inherits from class CPoint3.427
10.22 CCylinder3 class inherits from class CCircle3.429
10.23 CTest3 uses interfaces to demonstrate polymorphism in
Point-Circle-Cylinder hierarchy. 431
10.24 Bubble sort using delegates. 433
10.25 Bubble-sort Form application. 435
XXIV Illustrations
11 Exception Handling
11.1 Exception handlers for FormatException and

DivideByZeroException.447
11.2 Finally statements always execute, regardless of whether an
exception occurs. 454
11.3 Exception properties and stack unwinding. 462
11.4 ApplicationException derived class thrown when a program
performs an illegal operation on a negative number. 465
11.5 FrmSquareRoot class throws an exception if an error occurs
when calculating the square root. 466
11.6 OverflowException cannot occur if user disables
integer-overflow checking. 468
12 Graphical User Interface Concepts: Part 1
12.1 GUI components in a sample Internet Explorer window. 477
12.2 Some basic GUI components. 477
12.3 Components and controls for Windows Forms. 478
12.4 Common Form properties, methods and events. 479
12.5 Event-handling model using delegates. 480
12.6 Events section in the Method Name drop-down menu. 482
12.7 Simple event-handling example using visual programming. 482
12.8 List of Form events. 486
12.9 Click event details. 486
12.10 Class Control properties and methods. 487
12.11 Anchoring demonstration. 489
12.12 Manipulating the Anchor property of a control. 489
12.13 Docking demonstration. 490
12.14 Control layout properties. 490
12.15 Common Label properties. 491
12.16 TextBox properties and events. 492
12.17 Button properties and events. 493
12.18 Program to display hidden text in a password box. 493
12.19 GroupBox properties. 495

12.20 Panel properties. 495
12.21 Creating a Panel with scrollbars. 495
12.22 Using GroupBoxes and Panels to arrange Buttons . 496
12.23 CheckBox properties and events. 498
12.24 Using CheckBoxes to change font styles . 498
12.25 RadioButton properties and events. 501
12.26 Using RadioButtons to set message-window options. 502
12.27 PictureBox properties and events. 508
12.28 Using a PictureBox to display images . 508
12.29 Mouse events, delegates and event arguments. 510
12.30 Using the mouse to draw on a form. 511
12.31 Keyboard events, delegates and event arguments. 513
Illustrations XXV
12.32 Demonstrating keyboard events. 514
12.33 Abbreviations for controls introduced in chapter. 517
13 Graphical User Interfaces Concepts: Part 2
13.1 Expanded and checked menus. 525
13.2 Visual Studio .NET Menu Designer 526
13.3 Adding MenuItems to MainMenu.527
13.4 MainMenu and MenuItem properties and events. 527
13.5 Menus for changing text font and color. 528
13.6 LinkLabel control in running program. 534
13.7 LinkLabel properties and events. 534
13.8 LinkLabels used to link to a drive, a Web page and an application. 536
13.9 ListBox and CheckedListBox on a form. 538
13.10 ListBox properties, methods and events. 538
13.11 String Collection Editor.540
13.12 Program that adds, removes and clears ListBox items. 540
13.13 CheckedListBox properties, methods and events. 543
13.14 CheckedListBox and ListBox used in a program to display a

user selection. 544
13.15 ComboBox demonstration. 546
13.16 ComboBox properties and events. 546
13.17 ComboBox used to draw a selected shape. 547
13.18 TreeView displaying a sample tree. 550
13.19 TreeView properties and events. 550
13.20 TreeNode properties and methods. 551
13.21 TreeNode Editor.552
13.22 TreeView used to display directories. 553
13.23 ListView properties and events. 556
13.24 Image Collection Editor window for an ImageList component. 556
13.25 ListView displaying files and folders. 557
13.26 Tabbed windows in Visual Studio .NET. 562
13.27 TabControl with TabPages example. 563
13.28 TabPages added to a TabControl.563
13.29 TabControl properties and events. 564
13.30 TabControl used to display various font settings. 564
13.31 MDI parent window and MDI child windows. 568
13.32 SDI and MDI forms. 568
13.33 MDI parent and MDI child events and properties. 569
13.34 Minimized and maximized child windows. 570
13.35 MenuItem property MdiList example. 571
13.36 LayoutMdi enumeration values. 572
13.37 MDI parent-window class. 572
13.38 MDI child FrmChild. 575
13.39 Class FrmInheritance, which inherits from class Form, contains
a button (Learn More). 577
13.40 Visual Inheritance through the Form Designer. 578
XXVI Illustrations
13.41 Class FrmVisualTest, which inherits from class

VisualForm.FrmInheritance, contains an additional button. 579
13.42 Custom control creation. 581
13.43 UserControl-defined clock. 581
13.44 Custom-control creation. 583
13.45 Project properties dialog. 583
13.46 Custom control added to the ToolBox.584
13.47 Custom control added to a Form.584
13.48 Prefixes for controls used in chapter. 585
14 Multithreading
14.1 Thread life cycle. 595
14.2 Thread-priority scheduling. 597
14.3 ThreadStart delegate Print displays message and sleeps for
arbitrary duration of time. 598
14.4 Threads sleeping and printing. 600
14.5 Unsynchronized shared Integer buffer. 604
14.6 Producer places Integers in unsynchronized shared buffer. 605
14.7 Consumer reads Integers from unsynchronized shared buffer. 606
14.8 Producer and consumer threads accessing a shared object without
synchronization. 608
14.9 Synchronized shared Integer buffer. 610
14.10 Producer places Integers in synchronized shared buffer. 612
14.11 Consumer reads Integers from synchronized shared buffer. 612
14.12 Producer and consumer threads accessing a shared object with
synchronization. 613
14.13 Synchronized shared circular buffer. 620
14.14 Producer places Integers in synchronized circular buffer. 623
14.15 Consumer reads Integers from synchronized circular buffer. 624
14.16 Producer and consumer threads accessing a circular buffer. 625
15 Strings, Characters and Regular Expressions
15.1 String constructors. 635

15.2 String Length and Chars properties, and CopyTo method. 637
15.3 String test to determine equality. 639
15.4 StartsWith and EndsWith methods. 642
15.5 GetHashCode method demonstration. 643
15.6 Searching for characters and substrings in Strings. 644
15.7 Substrings generated from Strings. 647
15.8 Concat Shared method. 648
15.9 String methods Replace, ToLower, ToUpper,
Trim and ToString.649
15.10 StringBuilder class constructors . 651
15.11 StringBuilder size manipulation. 653
15.12 Append methods of StringBuilder.655
15.13 StringBuilder’s AppendFormat method. 656
15.14 StringBuilder text insertion and removal. 658
Illustrations XXVII
15.15 StringBuilder text replacement. 659
15.16 Char’s Shared character-testing methods and case-conversion methods. 661
15.17 CCard class. 663
15.18 Card dealing and shuffling simulation. 664
15.19 Character classes. 668
15.20 Regular expressions checking birthdays. 668
15.21 Quantifiers used regular expressions. 670
15.22 Validating user information using regular expressions. 670
15.23 Regex methods Replace and Split.675
16 Graphics and Multimedia
16.1 System.Drawing namespace’s Classes and Structures. 685
16.2 GDI+ coordinate system. Units are measured in pixels. 686
16.3 Color structure Shared constants and their RGB values. 688
16.4 Color structure members. 688
16.5 Classes that derive from class Brush.689

16.6 Color value and alpha demonstration. 689
16.7 ColorDialog used to change background and text color. 692
16.8 Font class read-only properties. 694
16.9 Fonts and FontStyles. 695
16.10 An illustration of font metrics. 697
16.11 FontFamily methods that return font-metrics information. 697
16.12 FontFamily class used to obtain font-metric information. 697
16.13 Graphics methods that draw lines, rectangles and ovals. 699
16.14 Drawing lines, rectangles and elipses. 700
16.15 Ellipse bounded by a rectangle. 702
16.16 Positive and negative arc angles. 702
16.17 Graphics methods for drawing arcs. 703
16.18 Arc method demonstration. 703
16.19 Graphics methods for drawing polygons. 705
16.20 Polygon drawing demonstration. 705
16.21 Shapes drawn on a form. 709
16.22 Paths used to draw stars on a form. 712
16.23 Image resizing. 714
16.24 Animation of a series of images. 717
16.25 Container class for chess pieces . 718
16.26 Chess-game code (part 1 of 9). 720
16.27 Windows Media Player demonstration. 729
16.28 Peedy introducing himself when the window opens. 732
16.29 Peedy’s Pleased animation. 733
16.30 Peedy’s reaction when he is clicked. 734
16.31 Peedy flying animation 734
16.32 Peedy waiting for speech input. 735
16.33 Peedy repeating the user’s request for Seattle style pizza. 736
16.34 Peedy repeating the user’s request for anchovies as an additional topping. 736
16.35 Peedy recounting the order. 737

XXVIII Illustrations
16.36 Peedy calculating the total. 737
16.37 Microsoft Agent demonstration. 738
16.38 GUI for eight queens exercise. 751
17 Files and Streams
17.1 Data hierarchy. 755
17.2 Visual Basic’s view of an n-byte file. 756
17.3 File class methods (partial list). 757
17.4 Directory class methods (partial list). 758
17.5 FrmFileTest class tests classes File and Directory. 759
17.6 FrmFileSearch class uses regular expressions to determine file types. 762
17.7 FrmBankUI class is the base class for GUIs in our
file-processing applications. 767
17.8 CRecord class represents a record for sequential-access file-processing
applications. 770
17.9 FrmCreateSequentialAccessFile class creates and writes
to sequential-access files. 772
17.10 Sample data for the program of Fig. 17.9. 779
17.11 FrmReadSequentialAccessFile class reads sequential-access files. 779
17.12 FrmCreditInquiry class is a program that displays credit inquiries. 783
17.13 Random-access file with fixed-length records. 790
17.14 CRandomAccessRecord class represents a record for
random-access file-processing applications. 791
17.15 FrmCreateRandomAccessFile class create files for
random-access file-processing applications. 794
17.16 FrmWriteRandomAccessFile class writes records to r
andom-access files. 798
17.17 FrmReadRandomAccessFile class reads records from
random-access files sequentially. 802
17.18 CTransaction class handles record transactions for the

transaction-processor case study. 808
17.19 FrmTransactionProcessor class runs the
transaction-processor application. 812
17.20 FrmStartDialog class enables users to access dialog
boxes associated with various transactions. 813
17.21 FrmNewDialog class enables users to create records in
transaction-processor case study. 816
17.22 FrmUpdateDialog class enables users to update records
in transaction-processor case study. 819
17.23 FrmDeleteDialog class enables users to remove records
from files in transaction-processor case study. 825
17.24 Inventory of a hardware store. 832
18 Extensible Markup Language (XML)
18.1 XML used to mark up an article. 834
18.2 article.xml displayed by Internet Explorer. 837
18.3 XML to mark up a business letter. 837
Illustrations XXIX
18.4 XML namespaces demonstration. 839
18.5 Default namespaces demonstration. 841
18.6 Tree structure for Fig. 18.1. 842
18.7 XmlNodeReader iterates through an XML document. 843
18.8 DOM structure of an XML document. 846
18.9 XPathNavigator class navigates selected nodes. 852
18.10 XML document that describes various sports. 859
18.11 XPath expressions and descriptions. 860
18.12 Document Type Definition (DTD) for a business letter. 861
18.13 XML document referencing its associated DTD. 863
18.14 XML Validator validates an XML document against a DTD. 864
18.15 XML Validator displaying an error message. 865
18.16 XML document that conforms to a Microsoft Schema document. 865

18.17 Schema file that contains structure to which book.xml conforms. 866
18.18 Schema-validation example. 867
18.19 XML file that does not conform to the Schema in Fig. 18.17. 869
18.20 XML document containing book information. 871
18.21 XSL document that transforms sorting.xml into XHTML. 872
18.22 XSL style sheet applied to an XML document. 875
18.23 BizTalk terminology. 877
18.24 BizTalk markup using an offer Schema. 878
19 Database, SQL and ADO .NET
19.1 Relational-database structure of an Employee table. 889
19.2 Result set formed by selecting Department and Location data
from the Employee table. 890
19.3 Authors table from Books.890
19.4 Data from the Authors table of Books.890
19.5 Publishers table from Books.891
19.6 Data from the Publishers table of Books.891
19.7 AuthorISBN table from Books.892
19.8 Data from AuthorISBN table in Books.892
19.9 Titles table from Books.893
19.10 Data from the Titles table of Books. 893
19.11 Table relationships in Books.896
19.12 SQL query keywords. 897
19.13 authorID and lastName from the Authors table. 898
19.14 Titles with copyrights after 1999 from table Titles.899
19.15 Authors from the Authors table whose last names start with D.900
19.16 Authors from table Authors whose last names contain i as their
second letter. 901
19.17 Authors from table Authors in ascending order by lastName.901
19.18 Authors from table Authors in descending order by lastName.902
19.19 Authors from table Authors in ascending order by lastName

and by firstName.903
19.20 Books from table Titles whose titles end with How to Program
in ascending order by title.904
XXX Illustrations
19.21 Authors from table Authors and ISBN numbers of the authors’
books, sorted in ascending order by lastName and firstName.905
19.22 Joining tables to produce a result set in which each record contains
an author, title, ISBN number, copyright and publisher name. 906
19.23 Portion of the result set produced by the query in Fig. 19.22. 907
19.24 Table Authors after an INSERT operation to add a record. 909
19.25 Table Authors after an UPDATE operation to change a record. 910
19.26 Table Authors after a DELETE operation to remove a record. 911
19.27 Database access and information display. 913
19.28 SQL statements executed on a database. 921
19.29 Database modification demonstration. 923
19.30 XML representation of a DataSet written to a file. 932
19.31 XML document generated from DataSet in XMLWriter.934
20 ASP .NET, Web Forms and Web Controls
20.1 Client interacting with Web server. Step 1: The GET request,
GET /books/downloads.htm HTTP/1.1.944
20.2 Client interacting with Web server. Step 2: The HTTP response,
HTTP/1.1 200 OK.944
20.3 Three-tier architecture. 945
20.4 ASPX page that displays the Web server’s time. 946
20.5 Code-behind file for a page that displays the Web server’s time. 948
20.6 HTML response when the browser requests WebTime.aspx.951
20.7 Creating an ASP.NET Web Application in Visual Studio. 953
20.8 Visual Studio creating and linking a virtual directory for the
WebTime project folder. 953
20.9 Solution Explorer window for project WebTime.953

20.10 Web Forms menu in the Toolbox.954
20.11 Design mode of Web Form designer. 954
20.12 HTML mode of Web-Form designer. 955
20.13 Code-behind file for WebForm1.aspx generated by Visual Studio .NET. 956
20.14 FlowLayout and GridLayout illustration. 956
20.15 WebForm.aspx after adding two Labels and setting their properties. 957
20.16 Commonly used Web controls. 958
20.17 Web-controls demonstration. 959
20.18 AdRotator class demonstrated on a Web form. 964
20.19 Code-behind file for page demonstrating the AdRotator class. 965
20.20 AdvertisementFile used in AdRotator example. 967
20.21 Validators used in a Web Form that generates possible letter
combinations from a phone number. 970
20.22 Code-behind file for the word-generator page. 972
20.23 HTML and JavaScript sent to the client browser. 976
20.24 ASPX file that presents a list of programming languages x. 981
20.25 Code-behind file that writes cookies to the client. 983
20.26 ASPX page that displays book information. 986
20.27 Cookies being read from a client in an ASP .NET application. 987
Illustrations XXXI
20.28 HttpCookie properties. 989
20.29 Options supplied on an ASPX page. 989
20.30 Sessions are created for each user in an ASP .NET Web application. 991
20.31 HttpSessionState properties. 995
20.32 Session information displayed in a ListBox.995
20.33 Session data read by an ASP .NET Web application to provide
recommendations for the user. 996
20.34 Guest-book application GUI. 998
20.35 ASPX file for the guest-book application. 999
20.36 Code-behind file for the guest-book application. 1001

20.37 Login Web Form. 1005
20.38 ASCX code for the header. 1007
20.39 Code-behind file for the login page for authors application. 1007
20.40 ASPX file that allows a user to select an author from a drop-down list. 1013
20.41 Database information being inputted into a DataGrid. 1014
20.42 ASPX page with tracing turned off. 1020
20.43 Tracing enabled on a page. 1020
20.44 Tracing information for a project. 1021
21 ASP .NET and Web Services
21.1 ASMX file rendered in Internet Explorer. 1033
21.2 Service description for a Web service. 1034
21.3 Invoking a method of a Web service from a Web browser. 1035
21.4 Results of invoking a Web-service method from a Web browser. 1035
21.5 SOAP request message for the HugeInteger Web service. 1036
21.6 HugeInteger Web service. 1038
21.7 Design view of a Web service. 1044
21.8 Adding a Web service reference to a project. 1045
21.9 Add Web Reference dialog. 1046
21.10 Web services located on localhost. 1046
21.11 Web reference selection and description. 1047
21.12 Solution Explorer after adding a Web reference to a project. 1047
21.13 Using the HugeInteger Web service. 1049
21.14 Blackjack Web service. 1054
21.15 Blackjack game that uses the Blackjack Web service. 1057
21.16 Airline reservation Web service. 1066
21.17 Airline Web Service in design view. 1069
21.18 ASPX file that takes reservation information. 1069
21.19 Code-behind file for the reservation page. 1070
21.20 TemperatureServer Web service. 1073
21.21 Class that stores weather information about a city. 1076

21.22 Receiving temperature and weather data from a Web service. 1077
21.23 Class that stores equation information. 1082
21.24 Web service that generates random equations. 1085
21.25 Returning an object from a Web-service method. 1086
21.26 Math-tutor application. 1087

×