|
Chapter 1
OVERVIEW OF THE MICROSOFT.NET
WHAT IS THE MICROSOFT .NET PLATFORM?
Overview of the .NET Framework
Benefits of the .NET Framework
Based on Web standards and practices
Extensible
Easy for developers to use
Designed using unified application models
Languages in the .NET Framework
Visual Basic .NET
C# ? designed for .NET
Managed Extensions to Visual C++
J# .NET
Third-party languages
WHAT ARE THE .NET
FRAMEWORK COMPONENTS?
The .NET Framework Components
Common Language Runtime
.NET Framework Class Library
ADO.NET: Data and XML
ASP.NET: Web Forms and Services
ASP .NET
User Interface
WHAT ARE THE VISUAL
BASIC.NET ENHANCEMENTS
Major language enhancements
Enhanced object-oriented support
Structured exception handling
Full access to the .NET Framework
New threading options
Garbage collection
Enhanced Web development
Create Web Forms as easily as Windows Forms
Create Web Services quickly
Chapter 2
DEVELOPMENT ENVIRONMENT FEATURES
DESCRIBING THE INTEGRATED DEVELOPMENT
ENVIRONMENT
There is one IDE for all .NET projects
Solutions can contain multiple
programming languages
Example: Visual Basic .NET and C# in the
same solution
Describing the Integrated Development
Environment
The IDE is customizable through “My
Profile
The IDE has a built-in Internet browser
CREATING VISUAL BASIC .NET
PROJECTS
Choosing a Project Template
Analyzing Project Structures
What Are Assemblies?
Setting Project References
What Are Namespaces?
Namespaces organize objects defined in an
assembly
Namespaces create fully qualified names for
objects
Creating Namespaces
Importing Namespaces
Setting Project Properties
Common Property Settings
Configuration Property Settings
USING DEVELOPMENT
ENVIRONMENT FEATURES
Using Solution Explorer
Displays project hierarchy
“Show All Files” mode
Manipulating projects
Using Server Explorer
Using the Object Browser
Using the Task List
Similar to the Tasks feature in Microsoft
Outlook
Stored with the solution in the .suo file
Adding to the Task List
Using Dynamic Help
Using XML Features
Recording and Using Macros
DEBUGGING APPLICATIONS
Setting Breakpoints
Debugging Code
Use the Debug menu or toolbar to step
through code
Use the debugging windows:
Use the debugging windows:
Using the Command Window
Immediate mode
Command mode
Switching modes
COMPILING IN VISUAL BASIC
.NET
Locating Syntax Errors
The Task List displays compilation errors
Double-click the entry to view the error
Compilation Options
Build configurations
Build options
Chapter 3
DATA TYPES
Common Type System
Integrated in the common language runtime
Shared by the runtime, compilers, and tools
Controls how the runtime declares, uses, and
manages types
Includes a set of predefined data types
Common type system objects are based on the
System.Object class
Comparing Value-Type and Reference-Type
Variables
Value-Type Variables
Directly contain their data
Each has its own copy of data
Operations on one cannot affect another
Assignment creates a copy of the data
Reference-Type Variables
Store references to their data (known as
objects)
Two reference variables can reference the
same object
Operations on one can affect another
New Data Types
Changes to Existing Data Types
Using CType to Convert Data Types
Use CType to convert values from one data
type to another data type
Similar to CStr and CInt in Visual Basic 6.0
Syntax:
USING VARIABLES
Declaring and Initializing Variables and
Arrays
You can initialize variables when you
declare them
You can initialize arrays with a size, but
they are no longer fixed
Declaring Multiple Variables
Declaring multiple variables in Visual Basic
6.0
Declaring multiple variables in Visual Basic
.NET
Variable Scope
Procedure scope
Block scope
Variables only accessible within that block
Lifetime of block variable is entire
procedure
Creating Data Structures
Structures replace user-defined types
Structures support many features of classes
Use Structure…End Structure to declare
structures
Declare structure members with an access
modifier
Compiler Options
Option Explicit
Option Strict
Enforces strict type semantics and restricts
implicit type conversion
Late binding by means of the Object data
type is not allowed
Option Base 1 Not Supported
Assignment Operators
Simplified variable assignment operators
Example: iResult += 25
FUNCTIONS, SUBROUTINES,
AND PROPERTIES
Calling Functions and Subroutines
Visual Basic 6.0
You must follow complex rules regarding use
of parentheses
You must use parentheses when using a return
value from a function
Visual Basic .NET
You must use parentheses to enclose the
parameters of any function or
subroutine
You must include empty parentheses for
procedures without parameters
Passing Arguments ByRef and ByVal
Visual Basic 6.0
Visual Basic .NET
ByVal is the default passing mechanism
Optional Arguments
Visual Basic 6.0
You do not need to specify default values
for optional parameters
You can use the IsMissing function
Visual Basic .NET
You must include default values for optional
parameters
The IsMissing function is not supported
Static Function and Static Sub
Visual Basic 6.0
You can place Static in front of any
Function or Sub procedure heading
Local variables in a static function or
static subroutine retain their values
between multiple calls
Visual Basic .NET
Static functions and static subroutines are
not supported
You must explicitly declare all static
variables
Returning Values from Functions
Visual Basic 6.0
Visual Basic .NET
You can use the function name
You can also use the Return statement
Using Default Properties
Visual Basic 6.0
Supports default properties on most objects
Use Set to determine whether assignment is
referring to the object or the
default property
Visual Basic .NET
Supports default properties only for
parameterized properties
Do not need to differentiate between object
and default property assignments
Default properties are commonly used to
index into collections
You can call default properties only if the
property takes parameters
EXCEPTION HANDLING
Structured Exception Handling
Disadvantages of unstructured error handling
Code is difficult to read, debug, and
maintain
Easy to overlook errors
Advantages of structured exception handling
Supported by multiple languages
Allows you to create protected blocks of
code
Allows filtering of exceptions similar to
Select Case statement
Allows nested handling
Code is easier to read, debug, and maintain
Try…Catch…Finally
Using Try…Catch…Finally
The System.Exception Class
Filtering Exceptions
Throwing Exceptions
Chapter 4
DESIGNING CLASSES
Use Case Diagrams
Use cases
Actors
Use Case Diagram Example
“Retrieve Customer Orders” use case
description
Extending Use Cases
uses - reuses an existing use case
extends - enhances an existing use case
Converting Use Cases into Classes
Nouns = classes or attributes
Verbs = operations (methods)
OBJECT-ORIENTED
PROGRAMMING CONCEPTS
Comparing Classes to Objects
Encapsulation
Abstraction
Decide what is important and what is not
Focus on and depend on what is important
Ignore and do not depend on what is
unimportant
Use encapsulation to enforce an abstraction
Association
Aggregation
Attributes and Operations
Attributes are the data contained in a class
Operations are the actions performed on that
data
Accessibility: Public (+), Private (-),
Protected (#)
ADVANCED OBJECT-ORIENTED
PROGRAMMING CONCEPTS
Inheritance
Interfaces
Polymorphism
USING MICROSOFT VISIO
Visio Overview
Use case diagrams
Class or static structure diagrams
Activity diagrams
Component diagrams
Deployment diagrams
Freeform modeling
Use Case Diagrams
Class Diagrams
Creating Class Diagrams
Chapter 5
DEFINING CLASSES
Procedure for Defining a Class
Using Access Modifiers
Declaring Methods
Declaring Properties
Using Attributes
Overloading Methods
Using Constructors
Using Destructors
CREATING AND DESTROYING
OBJECTS
Instantiating and Initializing Objects
Garbage Collection
Using the Dispose Method
INHERITANCE
What Is Inheritance?
Overriding and Overloading
Derived class can override an inherited
property or method
Use Overload keyword to overload inherited
property or method
Inheritance Example
Shadowing
Using the MyBase Keyword
Using the MyClass Keyword
INTERFACES
Defining Interfaces
Achieving Polymorphism
Interfaces
Inheritance
WORKING WITH CLASSES
Using Shared Data Members
Using Shared Procedure Members
Event Handling
Defining and raising events: same as Visual
Basic 6.0
WithEvents keyword: handles events as in
Visual Basic 6.0
AddHandler keyword: allows dynamic
connection to events
RemoveHandler keyword: disconnects from
event source
What Are Delegates?
Objects that call the methods of other
objects
Similar to function pointers in Visual C++
Reference type based on the System.Delegate
class
Type-safe, secure, managed objects
Using Delegates
Comparing Classes to Structures
Chapter 6
WHY USE WINDOWS FORMS
STRUCTURE OF WINDOWS FORMS
Windows Forms Class Hierarchy
Using the Windows.Forms.Application Class
Starting and ending applications
Using DoEvents
Setting and retrieving application
information
Examining the Code Behind Windows Forms
Imports
Class
USING WINDOWS FORMS
Using Form Properties
Dialog Result
Font
Opacity
MaximumSize and MinimumSize
TopMost
AcceptButton and CancelButton
Using Form Methods
Close
Show and ShowDialog
Using Form Events
Activated and Deactivate
Closing
Closed MenuStart and MenuComplete
Handling Events
Handling multiple events with one procedure
Using AddHandler
Creating MDI Forms
Creating the parent form
Creating child forms
Accessing child forms
Arranging child forms
Using Standard Dialog Boxes
Msg Box
Message Box Class
Input Box
USING CONTROLS
New Controls
Checked ListBox
Link Label
Splitter
ToolTip
NotifyIcon
Using Control Properties
Positioning
Anchor
Location
Text property
BringToFront and SendToBack
Focus
Creating Menus
Menu classes
Creating menus at design time
Creating menus at run time
Providing User Help
Implementing Drag-and-Drop Functionality
Starting the process
Changing the drag icon
WINDOWS FORMS INHERITANCE
Why Inherit from a Form?
Creating the Base Form
Creating the Inherited Form
Modifying the Base Form
Changing the base form
Checking derived forms
Chapter 7
USING WINDOWS FORMS CONTROLS
How to Use the StatusBar Control
How to Use the ToolBar and ImageList
Controls
USING DIALOG BOXES IN A
WINDOWS FORMS APPLICATION
Selecting Dialog Boxes in Visual Studio
.NET
How to Display Dialog Boxes in an
Application
DialogResult Property
How to Use Input from Dialog Boxes
Using the OpenFileDialog Control
VALIDATING USER INPUT
How to Validate Controls by Using the
Validating Event
ErrorProvider Control
ErrorProvider
Key Properties
Key Method
How to Use the ErrorProvider Control
Demonstration: Validating Data in a
Windows Forms Application
Chapter 8
OVERVIEW
EXTENDING AND CREATING CONTROLS
Options for Building Controls
Extended controls
Composite controls
Custom controls
How to Expose and Override Properties for
Controls
Exposing properties of a control within a
container
Overriding properties
To raise events for a composite control
To override events
How to Test a Control
Creating a Composite Control
ADDING DESIGN-TIME SUPPORT
FOR CONTROLS
Property Attributes
How to Add Attributes That Provide
Information to the Visual Designer
Design-Time Support Options Built into
the .NET Framework
Property Browser
Type Converter
Custom UI Editors
Custom Designers
Extenders
Adding Design-Time Support for Controls
LICENSING A CONTROL
Files in Licensing
LIC file
LICX file
.Licenses file
How to Enable Licensing for a Control
How LicFileLicenseProvider Works in .NET
|
Chapter 9
INTRODUCTION TO ASP.NET
Overview of ASP.NET
Code behind development
Code can be compiled using any
.NET-compatible language
ASP.NET pages run side-by-side with ASP
pages
Automatic support for multiple browsers
ASP.NET namespaces provide rich
functionality
Built-in support for Web Services
Using Response and Request Objects
Requesting information from the client
Sending information to the client
Maintaining Client-Side State
Maintaining control state across multiple
requests
Using cookies for enhanced client-side state
Maintaining Server-Side State
Application object maintains
application-level state
Session object maintains session-level state
Managing an ASP.NET Application
Configuring ASP.NET applications
Deploying ASP.NET applications
Updating ASP.NET applications
Overview of ASP.NET Security
Security settings stored in web.config file
Out-of-box authentication support
Role-based security architecture
Using Global Events with Global.asax
CREATING WEB FORM
APPLICATIONS
Structure of Web Forms
Web Forms separate declarative tags from
logic
Using HTML Controls
Direct relationship to preexisting HTML tags
ASP.NET includes HTML controls for commonly
used HTML elements
Advantages of Web Server Controls
Automatic browser detection
Strongly typed, consistent object model
Declared with XML tags
Rich functionality
Using Web Server Controls
Handling Events
BUILDING WEB SERVICES
What Are Web Services
Creating a Web Service
Add a Web Service module to the project
Create a Web Service description
Add public subroutines or functions to .asmx.vb
file
Enabling Web Service Discovery
Deploying and Publishing a Web Service
Deploying a Web Service
Publishing a Web Service
USING WEB SERVICES
Exploring Web Services
HTML description page
WSDL describes methods, arguments, and
responses
Invoking a Web Service from a Browser
Invoking a Web Service from a Client
Chapter 10
ADO.NET OVERVIEW
Introduction to ADO.NET
Benefits of ADO.NET
.NET DATA PROVIDERS
Using the Connection Object
Connecting from a Web application
Add a line to Web.config file
SqlConnection
Using the Command Object
Two ways to create a Command
Four ways to execute a Command
Using the Command Object with Stored
Procedures
Using the DataReader Object
Reading data
Retrieving data
Returning multiple result sets
Using the DataAdapter Object
THE DATASET OBJECT
Disconnected Data Review
The DataSet Object
Populating DataSets
Populating DataSets from an RDBMS
Programmatically creating DataSets
Using Relationships in DataSets
Creating relationships
Accessing related data
Using Constraints
Creating new constraints
Using existing constraints
Updating Data in the DataSet
Adding rows
Editing rows
Deleting data
Updating Data at the Source
Explicitly specifying the updates
Automatically generating the updates
DATA DESIGNERS AND DATA
BINDING
Designing DataSets
DataAdapter Configuration Wizard
Generate DataSet Tool
Data Form Wizard
Data Binding in Windows Forms
Simple binding
Complex binding
Data Binding in Web Forms
Use impersonation
Binding to read-only data
XML INTEGRATION
Why Use Schemas?
Describing XML Structure
Creating Schemas
Using XML Data and Schemas in ADO.NET
Loading XML data into a DataSet
Using a typed DataSet
DataSets and XmlDataDocuments
Chapter 11
COMPONENTS OVERVIEW
Types of Components
Structures
Modules
Classes
Component classes
Serviced components
User controls
Using Modules As Components
Using Classes As Components
Using Components in Unmanaged Client
Applications
Setting assembly properties
Exposing class members to COM and Component
Services
Define and implement interfaces
Use the ClassInterface attribute with
AutoDual value
Use the COMClass attribute
.NET Remoting Overview
CREATING SERVICED
COMPONENTS
Hosting Components in Component Services
Using Transactions
Using Object Pooling
Using Constructor Strings
Using Security
Using Other Component Services
Configuring Assemblies for Component
Services
Setting assembly attributes
Using Regsvcs to register and create
Component Services applications
Using Lazy Registration
CREATING COMPONENT CLASSES
Architecture of a Component Class
Creating a Component Class
Inherit the System.ComponentModel.Component
Add any sited components
Create required functionality
Build the assembly
THREADING
What Is a Thread?
The unit of execution that the CPU processes
Threads are scheduled
Advantages of Multithreading
Improved user interface responsiveness
No blocking
Asynchronous communication
No thread affinity
Creating Threads
Use the System.Threading.Thread class
Use a class if parameters are required
Using Threading
When to Use Threading
Use threads carefully
Prevent two threads from accessing shared
data simultaneously
Chapter 12
USING .NET AND COM COMPONENTS IN A WINDOWS
FORMS APPLICATION
COM vs .NET
How to Call COM Components from .NET
Role of the RCW
How to Generate Interop Assemblies
Private, Shared, and Primary Interop
Assemblies
Practice: Using COM Components in
.NET-Based Applications
CALLING WIN32 APIS FROM
WINDOWS FORMS APPLICATIONS
Platform Invocation Services
How to Define Functions by Using the
Declare Statement
How to Define Functions by Using the Dll
Import Attribute
DllImport attribute is used to define
functions
Parameters are used to specify specific
behavior
How to Call Win32 APIs from a Windows
Forms Application
Chapter 13
OVERVIEW
PRINTING FROM A WINDOWS FORMS APPLICATION
How Printing Works in a .NET Windows
Forms Application
Print Document Object
PrintPage Event and PrintPageEventArgs
How to Enable Printing in a Windows Forms
Application
Adding Print Support to a Windows Forms
Application
USING THE PRINT PREVIEW,
PAGE SETUP, AND PRINT DIALOGS
How to Use the PrintPreviewDialog Control
How to Use the PageSetupDialog Control
How to Use the PrintDialog Control
CONSTRUCTING PRINT DOCUMENT CONTENT BY USING
GDI+
What Is GDI+?
GDI+ (the new graphics device interface
Three parts of GDI
What Is the Graphics Object?
How to Create and Use Pens, Brushes, and
Fonts
How to Draw and Measure Text in the
PrintPage Event Procedure
To draw text
To measure text
How to Generate Print Content by Using
StreamReader
CREATING REPORTS BY USING
CRYSTAL REPORTS
Crystal Reports
How to Create and Format a Report by
Using Crystal Reports
How to View a Report by Using Crystal
Report Viewer
How to Add DataSets to a Report
Chapter 14
THE .NET ASYNCHRONOUS PROGRAMMING MODEL
What Is Asynchronous Programming?
Asynchronous Programming Support in the .NET
Framework
Asynchronous support is provided in many of
the logical areas
THE ASYNCHRONOUS
PROGRAMMING MODEL DESIGN PATTERN
Overview of the Asynchronous Programming
Model Design Pattern
Using the Design Pattern with an
Asynchronous Callback for Completion
How to Set Up and Initiate the Call
How to Receive Completion Notification
and Results
How to Return Control to the Main Thread
Making an Asynchronous Call to an XML Web
Service
HOW TO MAKE ASYNCHRONOUS
CALLS TO ANY METHOD
Overview of How to Make Asynchronous
Calls to Any Method
How to Create the Asynchronous Delegate
How to Initiate the Asynchronous Call
How to Complete the Asynchronous Call
How to Return Control to the Main Thread
and Update the UI
PROTECTING STATE AND DATA
IN A MULTITHREADED ENVIRONMENT
Automatic Synchronization
Synchronized Code Region
Manual Synchronization
Design applications to try to minimize
synchronization needs
Chapter 15
ADDING ACCESSIBILITY FEATURES
Accessibility Support in the .NET
Framework
Accessibility options
Microsoft accessibility aids
How to Make Forms and Controls Accessible
How to Test Accessibility
Adding Accessibility Support to an
Application
ADDING HELP TO AN
APPLICATION
Help in the .NET Framework
Context-sensitive Help
Help menu support
The ToolTip control
How to Add Context-Sensitive Help for
Forms and Controls
How to Link Help Topics to a Menu
LOCALIZING AN APPLICATION
Globalization
Localization
Localization in the .NET Framework
Localizing the user interface elements
Localizing other resources
How to Set Localization Properties
How to Create Localized Resource Files
How to Change the Locale
Chapter 16
DESCRIBING ASSEMBLIES
Assemblies Overview
Benefits of Strong-Named Assemblies
Guaranteed uniqueness
Protected version lineage
Enforced assembly integrity
Creating Strong-Named Assemblies
Requires identity, public key, and digital
signature
Generating the public-private key pair
Versioning Strong-Named Assemblies
Using the Global Assembly Cache
Performance
Shared location
File security
Side-by-side versioning
CHOOSING A DEPLOYMENT
STRATEGY
Deployment Overview
Copying Projects
Copying a project
Using the XCOPY command
Client must already have the .NET Framework
Application must have no external
dependencies
Deploying Projects
Windows Installer
Merge modules
Types of Deployment Projects
DEPLOYING APPLICATIONS
Creating a Merge Module Project
Never installed directly
Provides for safe un-install
Contains
One component per merge module
New merge module for component changes
Creating a Setup Project
Using the Editors
Registry
File types
User interface
Custom actions
Launch conditions
Creating Installation Components
EventLog
MessageQueue
PerformanceCounter
Service
ServiceProcess
Deploying the Application
Windows-based setup project
Web setup project
Chapter 17
SECURING WINDOWS FORMS APPLICATIONS
OVERVIEW
SECURITY IN THE .NET FRAMEWORK
Security Basics
What is Evidence?
Examples of Items that Make Up Evidence
Strength of Evidence
What are Permissions?
How Does Code Access Security Work
Code Groups
Policy Levels
What is Role-Based Security?
Identity
Principal
What is Authentication?
What is Authorization?
USING CODE ACCESS SECURITY
How to Use Code Access Security
Minimum permission sets (RequestMinimum)
Optional permission sets (RequestOptional)
Refused permissions (RequestRefused
How to Make Assembly Permission Requests
Administering Security Policy Settings
How to Test the Code Access Security of
an Application
Adding Permission Requests
USING ROLE-BASED SECURITY
How Role-Based Security Works
Authentication and authorization
Identities
Principals
How to Create WindowsPrincipal and
WindowsIdentity Objects
Creating objects for a single validation
Creating objects for repeated validation
How to Create GenericPrincipal and
GenericIdentity Objects
Create and initialize a GenericIdentity
object
Create and initialize a GenericPrincipal
object and attach it to the current thread
How to Use Principals and Identities to
Control Access to an Application
Identity
Role
Chapter 18
UPGRADING TO VISUAL BASIC .NET
OVERVIEW
DECIDING WHETHER TO UPGRADE
Advantages Gained
Cost Incurred
Ease of Upgrade
OPTIONS FOR UPGRADING
Complete Rewrite
Complete Upgrade
Partial Upgrade
RECOMMENDATIONS
Web client server
Traditional N-tier applications
Enterprise legacy applications
Stand-alone Windows-based applications
PERFORMING THE UPGRADE
Preparing for the Upgrade
Early binding
Null propagation (Null + anything = Null)
Date variables (change doubles to dates
Constants (VB constants: vbYesNo)
Data access (upgrade all RDO & DAO to ADO)
Using the Upgrade Wizard
Results of the Upgrade Wizard
Language changes
Form changes
Other changes
Completing the Upgrade
Upgrade Report (_UpgradeReport.htm)
Upgrade comments (UPGRADE_ISSUE,
UPGRADE_WARNING)
Task List entries
Testing
Other Tasks |