- •About the Authors
- •Contents at a Glance
- •Contents
- •Introduction
- •Goal of the Book
- •How to Use this Book
- •Introduction to the .NET Framework
- •Common Language Runtime (CLR)
- •Class Library
- •Assembly
- •Versioning
- •Exceptions
- •Threads
- •Delegates
- •Summary
- •Introduction to C#
- •Variables
- •Initializing Variables
- •Variable Modifiers
- •Variable Data Types
- •Types of Variables
- •Variable Scope
- •Types of Data Type Casting
- •Arrays
- •Strings
- •Initializing Strings
- •Working with Strings
- •Statements and Expressions
- •Types of Statements
- •Expressions
- •Summary
- •Classes
- •Declaring Classes
- •Inheritance
- •Constructors
- •Destructors
- •Methods
- •Declaring a Method
- •Calling a Method
- •Passing Parameters to Methods
- •Method Modifiers
- •Overloading a Method
- •Namespaces
- •Declaring Namespaces
- •Aliases
- •Structs
- •Enumerations
- •Interfaces
- •Writing, Compiling, and Executing
- •Writing a C# Program
- •Compiling a C# Program
- •Executing a C# Program
- •Summary
- •Arrays
- •Single-Dimensional Arrays
- •Multidimensional Arrays
- •Methods in Arrays
- •Collections
- •Creating Collections
- •Working with Collections
- •Indexers
- •Boxing and Unboxing
- •Preprocessor Directives
- •Summary
- •Attributes
- •Declaring Attributes
- •Attribute Class
- •Attribute Parameters
- •Default Attributes
- •Properties
- •Declaring Properties
- •Accessors
- •Types of Properties
- •Summary
- •Introduction to Threads
- •Creating Threads
- •Aborting Threads
- •Joining Threads
- •Suspending Threads
- •Making Threads Sleep
- •Thread States
- •Thread Priorities
- •Synchronization
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Primary and Foreign Keys
- •Referential Integrity
- •Normalization
- •Designing a Database
- •Low-Level Design
- •Construction
- •Integration and Testing
- •User Acceptance Testing
- •Implementation
- •Operations and Maintenance
- •Summary
- •Creating a New Project
- •Console Application
- •Windows Applications
- •Creating a Windows Application for the Customer Maintenance Project
- •Creating an Interface for Form1
- •Creating an Interface for WorkerForm
- •Creating an Interface for CustomerForm
- •Creating an Interface for ReportsForm
- •Creating an Interface for JobDetailsForm
- •Summary
- •Performing Validations
- •Identifying the Validation Mechanism
- •Using the ErrorProvider Control
- •Handling Exceptions
- •Using the try and catch Statements
- •Using the Debug and Trace Classes
- •Using the Debugging Features of Visual Studio .NET
- •Using the Task List
- •Summary
- •Creating Form1
- •Connecting WorkerForm to the Workers Table
- •Connecting CustomerForm to the tblCustomer Table
- •Connecting the JobDetails Form
- •to the tblJobDetails Table
- •Summary
- •Introduction to the Crystal Reports Designer Tool
- •Creating the Reports Form
- •Creating Crystal Reports
- •Creating the Windows Forms Viewer Control
- •Creating the Monthly Worker Report
- •Summary
- •Introduction to Deploying a Windows Application
- •Deployment Projects Available in Visual Studio .NET
- •Deployment Project Editors
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Populating the TreeView Control
- •Displaying Employee Codes in the TreeView Control
- •Event Handling
- •Displaying Employee Details in the ListView Control
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Adding the Programming Logic to the Application
- •Adding Code to the Form Load() Method
- •Adding Code to the OK Button
- •Adding Code to the Exit Button
- •Summary
- •The Created Event
- •Adding Code to the Created Event
- •Overview of XML
- •The XmlReader Class
- •The XmlWriter Class
- •Displaying Data in an XML Document
- •Displaying an Error Message in the Event Log
- •Displaying Event Entries from Event Viewer
- •Displaying Data from the Summary.xml Document in a Message Box
- •Summary
- •Airline Profile
- •Role of a Business Manager
- •Role of a Network Administrator
- •Role of a Line-of-Business Executive
- •Project Requirements
- •Creation and Deletion of User Accounts
- •Addition of Flight Details
- •Reservations
- •Cancellations
- •Query of Status
- •Confirmation of Tickets
- •Creation of Reports
- •Launch of Frequent Flier Programs
- •Summarizing the Tasks
- •Project Design
- •Database Design
- •Web Forms Design
- •Enabling Security with the Directory Structure
- •Summary
- •Getting Started with ASP.NET
- •Prerequisites for ASP.NET Applications
- •New Features in ASP.NET
- •Types of ASP.NET Applications
- •Exploring ASP.NET Web Applications
- •Introducing Web Forms
- •Web Form Server Controls
- •Configuring ASP.NET Applications
- •Configuring Security for ASP.NET Applications
- •Deploying ASP.NET Applications
- •Creating a Sample ASP.NET Application
- •Creating a New Project
- •Adding Controls to the Project
- •Coding the Application
- •Summary
- •Creating the Database Schema
- •Creating Database Tables
- •Managing Primary Keys and Relationships
- •Viewing the Database Schema
- •Designing Application Forms
- •Standardizing the Interface of the Application
- •Common Forms in the Application
- •Forms for Network Administrators
- •Forms for Business Managers
- •Forms for Line-of-Business Executives
- •Summary
- •The Default.aspx Form
- •The Logoff.aspx Form
- •The ManageUsers.aspx Form
- •The ManageDatabases.aspx Form
- •The ChangePassword.aspx Form
- •Restricting Access to Web Forms
- •The AddFl.aspx Form
- •The RequestID.aspx Form
- •The Reports.aspx Form
- •The FreqFl.aspx Form
- •Coding the Forms for LOB Executives
- •The CreateRes.aspx Form
- •The CancelRes.aspx Form
- •The QueryStat.aspx Form
- •The ConfirmRes.aspx Form
- •Summary
- •Designing the Form
- •The View New Flights Option
- •The View Ticket Status Option
- •The View Flight Status Option
- •The Confirm Reservation Option
- •Testing the Application
- •Summary
- •Locating Errors in Programs
- •Watch Window
- •Locals Window
- •Call Stack Window
- •Autos Window
- •Command Window
- •Testing the Application
- •Summary
- •Managing the Databases
- •Backing Up the SkyShark Airlines Databases
- •Exporting Data from Databases
- •Examining Database Logs
- •Scheduling Database Maintenance Tasks
- •Managing Internet Information Server
- •Configuring IIS Error Pages
- •Managing Web Server Log Files
- •Summary
- •Authentication Mechanisms
- •Securing a Web Site with IIS and ASP.NET
- •Configuring IIS Authentication
- •Configuring Authentication in ASP.NET
- •Securing SQL Server
- •Summary
- •Deployment Scenarios
- •Deployment Editors
- •Creating a Deployment Project
- •Adding the Output of SkySharkDeploy to the Deployment Project
- •Deploying the Project to a Web Server on Another Computer
- •Summary
- •Organization Profile
- •Project Requirements
- •Querying for Information about All Books
- •Querying for Information about Books Based on Criteria
- •Ordering a Book on the Web Site
- •Project Design
- •Database Design
- •Database Schema
- •Web Forms Design
- •Flowcharts for the Web Forms Modules
- •Summary
- •Introduction to ASP.NET Web Services
- •Web Service Architecture
- •Working of a Web Service
- •Technologies Used in Web Services
- •XML in a Web Service
- •WSDL in a Web Service
- •SOAP in a Web Service
- •UDDI in a Web Service
- •Web Services in the .NET Framework
- •The Default Code Generated for a Web Service
- •Testing the SampleWebService Web Service
- •Summary
- •Creating the SearchAll() Web Method
- •Creating the SrchISBN() Web Method
- •Creating the AcceptDetails() Web Method
- •Creating the GenerateOrder() Web Method
- •Testing the Web Service
- •Securing a Web Service
- •Summary
- •Creating the Web Forms for the Bookers Paradise Web Site
- •Adding Code to the Web Forms
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Overview of Mobile Applications
- •The Microsoft Mobile Internet Toolkit
- •Overview of WAP
- •The WAP Architecture
- •Overview of WML
- •The Mobile Web Form
- •The Design of the MobileTimeRetriever Application
- •Creating the Interface for the Mobile Web Forms
- •Adding Code to the MobileTimeRetriever Application
- •Summary
- •Creating the Forms Required for the MobileCallStatus Application
- •Creating the frmLogon Form
- •Creating the frmSelectOption Form
- •Creating the frmPending Form
- •Creating the frmUnattended Form
- •Adding Code to the Submit Button in the frmLogon Form
- •Adding Code to the Query Button in the frmSelectOption Form
- •Adding Code to the Mark checked as complete Button in the frmPending Form
- •Adding Code to the Back Button in the frmPending Form
- •Adding Code to the Accept checked call(s) Button in the frmUnattended Form
- •Adding Code to the Back Button in the frmUnattended Form
- •Summary
- •What Is COM?
- •Windows DNA
- •Microsoft Transaction Server (MTS)
- •.NET Interoperability
- •COM Interoperability
- •Messaging
- •Benefits of Message Queues
- •Limitations
- •Key Messaging Terms
- •Summary
- •Pointers
- •Declaring Pointers
- •Types of Code
- •Implementing Pointers
- •Using Pointers with Managed Code
- •Working with Pointers
- •Compiling Unsafe Code
- •Summary
- •Introduction to the Languages of Visual Studio .NET
- •Visual C# .NET
- •Visual Basic .NET
- •Visual C++ .NET
- •Overview of Visual Basic .NET
- •Abstraction
- •Encapsulation
- •Inheritance
- •Polymorphism
- •Components of Visual Basic .NET
- •Variables
- •Constants
- •Operators
- •Arrays
- •Collections
- •Procedures
- •Arguments
- •Functions
- •Adding Code to the Submit Button
- •Adding Code to the Exit Button
- •Summary
- •Introduction to Visual Studio .NET IDE
- •Menu Bar
- •Toolbars
- •Visual Studio .NET IDE Windows
- •Toolbox
- •The Task List Window
- •Managing Windows
- •Customizing Visual Studio .NET IDE
- •The Options Dialog Box
- •The Customize Dialog Box
- •Summary
- •Index
Contents
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
Goal of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi How to Use this Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxii
PART I INTRODUCTION TO C# . . . . . . . . . . . . . . . . . 1
Chapter 1 Overview of the .NET Framework . . . . . . . . . . . 3
Introduction to the .NET Framework . . . . . . . . . . . . . . . . . . . . . . 4 Common Language Runtime (CLR) . . . . . . . . . . . . . . . . . . . . 6 Class Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
An Overview of .NET Framework Base Classes . . . . . . . . . . . . . 14 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Delegates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Chapter 2 C# Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . |
17 |
Introduction to C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Initializing Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Variable Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Variable Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Types of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Types of Data Type Casting . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
xii Contents
Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Initializing Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Working with Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Statements and Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Types of Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
PART II HANDLING DATA . . . . . . . . . . . . . . . . . . . . 41
Chapter 3 Components of C# . . . . . . . . . . . . . . . . . . . . . 43
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Declaring Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Declaring a Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Calling a Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Passing Parameters to Methods . . . . . . . . . . . . . . . . . . . . . . . 52
Method Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Overloading a Method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Namespaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Declaring Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Accessing Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Contents xiii
Writing, Compiling, and Executing a C# Program. . . . . . . . . . . . 64
Writing a C# Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Compiling a C# Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Executing a C# Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Chapter 4 More about Components . . . . . . . . . . . . . . . . 67
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Single-Dimensional Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Multidimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Methods in Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Creating Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Working with Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Indexers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Boxing and Unboxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Preprocessor Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 #region and #endregion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 #define and #undef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 #if, #endif, #else, and #elif. . . . . . . . . . . . . . . . . . . . . . . . . . 80 #error and #warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Chapter 5 Attributes and Properties . . . . . . . . . . . . . . . 83
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Declaring Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Attribute Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Attribute Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Default Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
xiv Contents
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Declaring Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Types of Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Chapter 6 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Introduction to Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Aborting Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Joining Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Suspending Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Making Threads Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Thread States. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Thread Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
PART III PROFESSIONAL PROJECT 1 . . . . . . . . . . . 109
Project 1 Creating a Customer Maintenance Project. . 111
Project 1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Chapter 7 Project Case Study . . . . . . . . . . . . . . . . . . . 113
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Project Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Analyzing Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
High-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Primary and Foreign Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Contents xv
Designing a Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Designing the Windows Forms
Used in Customer Maintenance Project . . . . . . . . . . . . . . . . 130
Low-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Integration and Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
User Acceptance Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Operations and Maintenance . . . . . . . . . . . . . . . . . . . . . . . . 138
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Chapter 8 Windows Forms and Controls. . . . . . . . . . . . 141
Introduction to Visual Studio .NET Projects. . . . . . . . . . . . . . . 142 Creating a New Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Console Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Windows Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Creating a Windows Application
for the Customer Maintenance Project. . . . . . . . . . . . . . . . . . . . 164 Creating an Interface for Form1 . . . . . . . . . . . . . . . . . . . . . . . 165 Creating an Interface for WorkerForm . . . . . . . . . . . . . . . . . . . 167 Creating an Interface for CustomerForm . . . . . . . . . . . . . . . . . 168 Creating an Interface for ReportsForm . . . . . . . . . . . . . . . . . . 170 Creating an Interface for JobDetailsForm . . . . . . . . . . . . . . . 172
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Chapter 9 Validations and Exception Handling . . . . . . . 175
Performing Validations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Identifying the Validation Mechanism . . . . . . . . . . . . . . . . . 177
Using the ErrorProvider Control . . . . . . . . . . . . . . . . . . . . . 183
Handling Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Using the try and catch Statements . . . . . . . . . . . . . . . . . . . 187
Using the Debug and Trace Classes . . . . . . . . . . . . . . . . . . . . 189
xvi Contents
Debugging the Customer Management Application . . . . . . . . . 190
Using the Debugging Features of Visual Studio .NET . . . . . 190
Using the Task List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Chapter 10 Database Interaction Using ADO.NET . . . . . . 197
Connecting Windows Forms to a Data Source
Using ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Creating Form1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Connecting WorkerForm to the Workers Table . . . . . . . . . . . 200 Connecting CustomerForm to the tblCustomer Table . . . . . . 211 Connecting the JobDetails Form
to the tblJobDetails Table . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Chapter 11 Crystal Reports . . . . . . . . . . . . . . . . . . . . . . 239
Introduction to the Crystal Reports Designer Tool. . . . . . . . . . . 240
Creating the Reports Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Creating Crystal Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Creating the Windows Forms Viewer Control . . . . . . . . . . . 248
Creating the Monthly Customer Visit Report . . . . . . . . . . . . . . 251
Creating the Monthly Balancing and Alignment Report . . . . . . 254
Creating the Monthly Worker Report . . . . . . . . . . . . . . . . . . . . 256
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Chapter 12 Deploying a Windows Application. . . . . . . . . 259
Introduction to Deploying a Windows Application . . . . . . . . . . 260
Deployment Projects Available in Visual Studio .NET . . . . . 261
Deployment Project Editors . . . . . . . . . . . . . . . . . . . . . . . . . 279
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Contents xvii
PART IV |
PROFESSIONAL PROJECT 2 . . . . . . . . . . . |
293 |
Project 2 Creating the Employee
Records System (ERS) Project. . . . . . . . . . . 295
Project 2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Chapter 13 Project Case Study and Design . . . . . . . . . . 297
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Project Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Analyzing Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
High-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Low-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Chapter 14 Implementing the Business Logic. . . . . . . . . 311
Populating the TreeView Control . . . . . . . . . . . . . . . . . . . . . . . 312
Displaying Employee Codes in the TreeView Control . . . . . 313
Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Displaying Employee Details in the ListView Control . . . . . 318
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
PART V PROFESSIONAL PROJECT 3 . . . . . . . . . . . 329
Project 3 Creating a Creative Learning Project . . . . . . 331
Project 3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
xviii Contents
Chapter 15 Project Case Study and Design . . . . . . . . . . 333
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Project Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Analyzing Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
High-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Low-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Chapter 16 Implementing the Programming Logic . . . . . 349
Adding the Programming Logic to the Application . . . . . . . . . . 350
Adding Code to the Form Load() Method . . . . . . . . . . . . . . 351
Adding Code to the OK Button . . . . . . . . . . . . . . . . . . . . . . 353
Adding Code to the Exit Button . . . . . . . . . . . . . . . . . . . . . 363
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Chapter 17 Interacting with a Microsoft Word |
|
Document and Event Viewer . . . . . . . . . . . . |
365 |
Interacting with a Microsoft Word Document. . . . . . . . . . . . . . 366
The Created Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Adding Code to the Created Event. . . . . . . . . . . . . . . . . . . . 367
Overview of XML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
The XmlReader Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
The XmlWriter Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
Displaying Data in an XML Document . . . . . . . . . . . . . . . . 373
Displaying an Error Message in the Event Log. . . . . . . . . . . 377
Displaying Event Entries from Event Viewer . . . . . . . . . . . . 383
Displaying Data from the Summary.xml
Document in a Message Box . . . . . . . . . . . . . . . . . . . . . . . . 385
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Contents xix
PART VI |
PROFESSIONAL PROJECT 4 . . . . . . . . . . . |
395 |
Project 4 Creating an Airline Reservation Portal. . . . . 397
Project 4 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Chapter 18 Project Case Study and Design . . . . . . . . . . 399
Airline Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Role of a Business Manager . . . . . . . . . . . . . . . . . . . . . . . . . 401
Role of a Network Administrator . . . . . . . . . . . . . . . . . . . . . 402
Role of a Line-of-Business Executive . . . . . . . . . . . . . . . . . . 402
Project Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Creation and Deletion of User Accounts. . . . . . . . . . . . . . . . 403
Addition of Flight Details . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Reservations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Cancellations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Query of Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Confirmation of Tickets. . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Creation of Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Launch of Frequent Flier Programs . . . . . . . . . . . . . . . . . . . 406
Summarizing the Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Project Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Web Forms Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Enabling Security with the Directory Structure. . . . . . . . . . . 425
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Chapter 19 Basics of ASP.NET Web Applications . . . . . . 429
Getting Started with ASP.NET. . . . . . . . . . . . . . . . . . . . . . . . . 430
Prerequisites for ASP.NET Applications. . . . . . . . . . . . . . . . 431
New Features in ASP.NET. . . . . . . . . . . . . . . . . . . . . . . . . . 431
Types of ASP.NET Applications . . . . . . . . . . . . . . . . . . . . . 433
xx Contents
Chapter 20
Exploring ASP.NET Web Applications. . . . . . . . . . . . . . . . . . |
. 434 |
||||
Introducing Web Forms |
. . . |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 434 |
||
Web Form Server Controls. |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 436 |
|||
Configuring ASP.NET Applications . . . . . . . . . . . . . . . . . . . . |
. 442 |
||||
Configuring Security for ASP.NET Applications . . . . . . . . |
. 442 |
||||
Deploying ASP.NET Applications . . . . . . . . . . . . . . . . . . . |
. 443 |
||||
Creating a Sample ASP.NET Application . . . . . . . . . . . . . . . . |
. 443 |
||||
Creating a New Project |
. . . |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 444 |
||
|
|
F |
|
||
Adding Controls to the Project. . . . . . . . . . . . . . . . . . . . . . |
. 444 |
||||
Coding the Application |
. . . |
Y. . . . . . . . . . . . . . . . . . . . . . . . |
. 446 |
||
|
|
M |
|
|
|
Summary |
. . . . . . . |
. . . . . . . |
L. . . . . . . . . . . . . . . . . . . . . . . . . . . |
. 452 |
|
|
A |
|
|
|
|
|
E |
|
|
|
|
Designing the pplication . . . . . . . . . . . . . . |
453 |
||||
T |
|
|
|
|
|
Creating the Database Schema |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 454 |
|||
Creating Database Tables . . |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 455 |
|||
Managing Primary Keys and Relationships. . . . . . . . . . . . . |
. 460 |
||||
Viewing the Database Schema . . . . . . . . . . . . . . . . . . . . . . |
. 464 |
||||
Designing Application Forms . |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 465 |
|||
Standardizing the Interface of the Application . . . . . . . . . . |
. 465 |
||||
Common Forms in the Application . . . . . . . . . . . . . . . . . . |
. 465 |
||||
Forms for Network Administrators. . . . . . . . . . . . . . . . . . . |
. 470 |
||||
Forms for Business Managers . . . . . . . . . . . . . . . . . . . . . . . |
. 473 |
||||
Forms for Line-of-Business Executives. . . . . . . . . . . . . . . . |
. 478 |
||||
Summary. |
. . . . . . . |
. . . . . . |
. . . |
. . . . . . . . . . . . . . . . . . . . . . . . |
. 481 |
Chapter 21 Implementing the Business Logic. . . . . . . . . 483
Coding the Logon and Logoff Functionality . . . . . . . . . . . . . . . 484
The Default.aspx Form. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
The Logoff.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Team-Fly®
Contents xxi
Coding the Forms for Network Administrators . . . . . . . . . . . . . 490
The ManageUsers.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . 490
The ManageDatabases.aspx Form. . . . . . . . . . . . . . . . . . . . . 495
The ChangePassword.aspx Form . . . . . . . . . . . . . . . . . . . . . 498
Restricting Access to Web Forms . . . . . . . . . . . . . . . . . . . . . 498
Coding the Forms for Business Managers . . . . . . . . . . . . . . . . . 500
The AddFl.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
The RequestID.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . 503
The Reports.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
The FreqFl.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
Coding the Forms for LOB Executives . . . . . . . . . . . . . . . . . . . 508
The CreateRes.aspx Form. . . . . . . . . . . . . . . . . . . . . . . . . . . 508
The CancelRes.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . 514
The QueryStat.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . . 516
The ConfirmRes.aspx Form . . . . . . . . . . . . . . . . . . . . . . . . . 518
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Chapter 22 Creating the Customer Transaction Portal . . 521
Designing the Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
The View New Flights Option . . . . . . . . . . . . . . . . . . . . . . . 525
The View Ticket Status Option . . . . . . . . . . . . . . . . . . . . . . 526
The View Flight Status Option . . . . . . . . . . . . . . . . . . . . . . 528
The Confirm Reservation Option. . . . . . . . . . . . . . . . . . . . . 529
Testing the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
xxii Contents
Chapter 23 Debugging and Testing the Application. . . . . 537
Locating Errors in Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Watch Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Locals Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Call Stack Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Autos Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Command Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Testing the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Chapter 24 Administering the Application . . . . . . . . . . . 551
Managing the Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Backing Up the SkyShark Airlines Databases . . . . . . . . . . . . 553
Exporting Data from Databases . . . . . . . . . . . . . . . . . . . . . . 555
Examining Database Logs . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Scheduling Database Maintenance Tasks . . . . . . . . . . . . . . . 558
Managing Internet Information Server . . . . . . . . . . . . . . . . . . . 560
Configuring IIS Error Pages. . . . . . . . . . . . . . . . . . . . . . . . . 560
Managing Web Server Log Files . . . . . . . . . . . . . . . . . . . . . 563
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Chapter 25 Securing the Application . . . . . . . . . . . . . . . 567
Security in ASP.NET Applications . . . . . . . . . . . . . . . . . . . . . . 568
Authentication Mechanisms. . . . . . . . . . . . . . . . . . . . . . . . . 568
Securing a Web Site with IIS and ASP.NET . . . . . . . . . . . . 570
Enabling Authentication in SkyShark Airlines. . . . . . . . . . . . . . 571
Configuring IIS Authentication . . . . . . . . . . . . . . . . . . . . . . 571
Configuring Authentication in ASP.NET. . . . . . . . . . . . . . . 573
Securing SQL Ser ver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
Contents xxiii
Chapter 26 Deploying the Application . . . . . . . . . . . . . . 581
Deployment Scenarios. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 Deployment Editors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 Deploying the SkyShark Airlines Application . . . . . . . . . . . . . . 586 Creating a Deployment Project. . . . . . . . . . . . . . . . . . . . . . . 587
Adding the Output of SkySharkDeploy
to the Deployment Project . . . . . . . . . . . . . . . . . . . . . . . . . . 589 Deploying the Project to a Web Server
on Another Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
PART VII PROFESSIONAL PROJECT 5 . . . . . . . |
. . . . 593 |
Project 5 Creating a Web Portal for a Bookstore |
. . . . 595 |
Project 5 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Chapter 27 Project Case Study and Design . . . . . . . . . . 597
Organization Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Project Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Querying for Information about All Books. . . . . . . . . . . . . . 600
Querying for Information about Books Based on Criteria. . . 601
Ordering a Book on the Web Site. . . . . . . . . . . . . . . . . . . . . 602
Project Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
Database Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
Database Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Web Forms Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
Flowcharts for the Web Forms Modules. . . . . . . . . . . . . . . . 616
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
xxiv Contents
Chapter 28 Exploring ASP.NET Web Services . . . . . . . . . 619
Introduction to ASP.NET Web Services . . . . . . . . . . . . . . . . . . 621 Web Service Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 Working of a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . 624 Technologies Used in Web Services . . . . . . . . . . . . . . . . . . . . . . 625 XML in a Web Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 WSDL in a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 SOAP in a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 UDDI in a Web Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 Web Services in the .NET Framework . . . . . . . . . . . . . . . . . . . 628 Creating a Simple Web Service in the .NET Framework . . . . . . 632 The Default Code Generated for a Web Service. . . . . . . . . . 633
Creating a Web Method
in the SampleWebService Web Service. . . . . . . . . . . . . . . . . 635 Testing the SampleWebService Web Service. . . . . . . . . . . . . 638 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Chapter 29 Developing Web Services. . . . . . . . . . . . . . . 641
Creating a Web Service for Deepthoughts Publications . . . . . . . 642
Creating the SearchAll() Web Method . . . . . . . . . . . . . . . . 645
Creating the SrchISBN() Web Method . . . . . . . . . . . . . . . . . 647
Creating the AcceptDetails() Web Method . . . . . . . . . . . . . 650
Creating the GenerateOrder() Web Method . . . . . . . . . . . . . 653
Testing the Web Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . 662
Securing a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
Contents xxv
Chapter 30 Developing Web Service Clients. . . . . . . . . . 667
Creating a Web Service Client Application
for Bookers Paradise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 Creating the Web Forms
for the Bookers Paradise Web Site . . . . . . . . . . . . . . . . . . . . 668 Adding Code to the Web Forms. . . . . . . . . . . . . . . . . . . . . . 680 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
PART VIII PROFESSIONAL PROJECT 6 . . . . . . . . . . . |
713 |
Project 6 Creating a Mobile Application . . . . . . . . . . . 715
Project 6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
Chapter 31 Project Case Study and Design . . . . . . . . . . 717
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
Project Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
Analyzing Requirements. . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
High-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
Low-Level Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
Chapter 32 Basics of Mobile Applications . . . . . . . . . . . 727
Overview of Mobile Applications . . . . . . . . . . . . . . . . . . . . . . . 728
The Microsoft Mobile Internet Toolkit. . . . . . . . . . . . . . . . . 729
Overview of WAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
The WAP Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Overview of WML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
xxvi Contents
Creating a Simple Mobile Web Application
by Using the Mobile Internet Toolkit. . . . . . . . . . . . . . . . . . . . . 736 The Mobile Web Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 The Design of the MobileTimeRetriever Application . . . . . . 739 Creating the Interface for the Mobile Web Forms. . . . . . . . . 751 Adding Code to the MobileTimeRetriever Application . . . . 754
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
Chapter 33 Implementing the Business Logic. . . . . . . . . 763
Creating the Forms Required
for the MobileCallStatus Application . . . . . . . . . . . . . . . . . . . . 764 The Default Code Generated by Visual Studio .NET
for a Mobile Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 765 Creating the frmLogon Form . . . . . . . . . . . . . . . . . . . . . . . . 767 Creating the frmSelectOption Form . . . . . . . . . . . . . . . . . . . 769 Creating the frmPending Form. . . . . . . . . . . . . . . . . . . . . . . 771 Creating the frmUnattended Form . . . . . . . . . . . . . . . . . . . . 772
Adding the Business Logic
to the MobileCallStatus Application . . . . . . . . . . . . . . . . . . . . . 774 Adding Code to the Submit Button
in the frmLogon Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775 Adding Code to the Query Button
in the frmSelectOption Form . . . . . . . . . . . . . . . . . . . . . . . . 779 Adding Code to the Mark checked as complete
Button in the frmPending Form . . . . . . . . . . . . . . . . . . . . . . 782 Adding Code to the Back Button
in the frmPending Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785 Adding Code to the Accept checked call(s) Button
in the frmUnattended Form . . . . . . . . . . . . . . . . . . . . . . . . . 786 Adding Code to the Back Button
in the frmUnattended Form . . . . . . . . . . . . . . . . . . . . . . . . . 788 Testing the MobileCallStatus Application in an Emulator . . . . . 788 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
Contents xxvii
PART IX BEYOND THE LABS . . . . . . . . . . . . . . . . . |
793 |
Chapter 34 Advanced C# Concepts . . . . . . . . . . . . . . . . 795
COM+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
What Is COM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
Windows DNA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
Microsoft Transaction Server (MTS) . . . . . . . . . . . . . . . . . . 804
COM+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
.NET Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
COM Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
Messaging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
Benefits of Message Queues. . . . . . . . . . . . . . . . . . . . . . . . . 819
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
Key Messaging Terms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
System.Messaging Namespace . . . . . . . . . . . . . . . . . . . . . . . . 822
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
PART X APPENDIXES . . . . . . . . . . . . . . . . . . . . . 829
Appendix A Unsafe Code . . . . . . . . . . . . . . . . . . . . . . . . 831
Pointers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832
Declaring Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
Types of Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
Implementing Pointers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836
Using Pointers with Managed Code . . . . . . . . . . . . . . . . . . . 837
Working with Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
Compiling Unsafe Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
Appendix B Introduction to Visual Basic .NET. . . . . . . . . 843
Introduction to the Languages of Visual Studio .NET . . . . . . . . 844 Visual C# .NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
xxviii Contents
Visual Basic .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
Visual C++ .NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
Overview of Visual Basic .NET. . . . . . . . . . . . . . . . . . . . . . . . . 846
Features of an Object-Oriented Programming Language . . . . . . 849
Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849
Encapsulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851
Components of Visual Basic .NET . . . . . . . . . . . . . . . . . . . . . . 852
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 852
Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
Collections. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862
Arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864
Creating a Simple Visual C# .NET Windows Application. . . . . 865
Creating a Simple Application in Visual Basic .NET . . . . . . . . . 868
Adding Code to the Submit Button . . . . . . . . . . . . . . . . . . . 872
Adding Code to the Exit Button . . . . . . . . . . . . . . . . . . . . . 873
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
Appendix C Visual Studio .NET Integrated |
|
Development Environment . . . . . . . . . . . . . . |
877 |
Introduction to Visual Studio .NET IDE . . . . . . . . . . . . . . . . |
. 878 |
Contents xxix
Menu Bar. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
Toolbars. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880
Visual Studio .NET IDE Windows . . . . . . . . . . . . . . . . . . . 882
Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888
The Task List Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890
Managing Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891
Customizing Visual Studio .NET IDE . . . . . . . . . . . . . . . . . . . 892
The Options Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . 892
The Customize Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . 894
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
This page intentionally left blank
|
|
Y |
|
L |
|
|
F |
|
|
M |
|
A |
|
|
E |
|
|
T |
|
|
Team-Fly®