14
 Part Number: X08-82469 Course Number: 2555A Released: 05/2002 Delivery Guide Developing Microsoft® .NET  Applications for Windows® (Visual C#  .NET).

82469

  • Upload
    myxro

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 1/14

 

Part Number: X08-82469

Course Number: 2555A

Released: 05/2002 

Delivery Guide

Developing Microsoft® .NET Applications for Windows® 

(Visual C#

 .NET).

Page 2: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 2/14

 

Information in this document, including URL and other Internet Web site references, is subject to

change without notice. Unless otherwise noted, the example companies, organizations, products,

domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious,

and no association with any real company, organization, product, domain name, e-mail address,

logo, person, place or event is intended or should be inferred. Complying with all applicable

copyright laws is the responsibility of the user. Without limiting the rights under copyright, no

 part of this document may be reproduced, stored in or introduced into a retrieval system, or

transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or

otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual

 property rights covering subject matter in this document. Except as expressly provided in any

written license agreement from Microsoft, the furnishing of this document does not give you any

license to these patents, trademarks, copyrights, or other intellectual property.

© 2002 Microsoft Corporation. All rights reserved.

Microsoft, MS-DOS, Windows, Windows NT, Active X, Authenticode, FrontPage, IntelliSense,

MSDN, PowerPoint, Visual Basic, Visual C#, Visual Studio, Win32, and Windows Media are

either registered trademarks or trademarks of Microsoft Corporation in the United States and/or

other countries.

The names of actual companies and products mentioned herein may be the trademarks of their

respective owners.

Course Number: 2555A

Part Number: X08-82469

Released: 05/2002

Page 3: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 3/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). iii

ContentsIntroduction 

Course Materials......................................................................................................2 

Prerequisites.............................................................................................................3  

Course Outline .........................................................................................................4 

Demonstration: Expense Report Application...........................................................6 

Demonstration: Purchase Order Application...........................................................9 

Microsoft Certified Professional Program .............................................................15 

Facilities.................................................................................................................17  

Module 1: Introducing Windows Forms 

Overview..................................................................................................................1  

Lesson: Creating a Form..........................................................................................2 

Lesson: Adding Controls to a Form.......................................................................17 

Lesson: Creating an Inherited Form.......................................................................26 

Lesson: Organizing Controls on a Form................................................................35 

Lesson: Creating MDI Applications ......................................................................43 

Review ...................................................................................................................52 

Lab 1.1: Creating Windows Forms........................................................................54 

Module 2: Working with Controls 

Overview..................................................................................................................1  

Lesson: Creating an Event Handler for a Control....................................................2 

Lesson: Using Windows Forms Controls ..............................................................12 

Lesson: Using Dialog Boxes in a Windows Forms Application............................33 

Lesson: Adding Controls at Run Time ..................................................................43 

Lesson: Creating Menus ........................................................................................49 

Lesson: Validating User Input ...............................................................................59 

Review ...................................................................................................................67 Lab 2.1: Working with Controls ............................................................................69 

Module 3: Building Controls 

Overview..................................................................................................................1  

Lesson: Extending and Creating Controls................................................................2 

Lesson: Adding Design-Time Support for Controls..............................................19 

Lesson: Licensing a Control ..................................................................................27 

Review ...................................................................................................................38 

Lab 3.1: Building Controls ....................................................................................40 

Module 4: Using Data in Windows Forms Applications 

Overview..................................................................................................................1  

Lesson: Adding ADO.NET Objects to and Configuring ADO.NET Objects in aWindows Forms Application ...................................................................................2 

Lesson: Accessing and Modifying Data by Using DataSets..................................14 

Lesson: Binding Data to Controls..........................................................................33 

Lab 4.1: Accessing Data by Using ADO.NET ......................................................47 

Lesson: Overview of XML Web Services .............................................................59 

Lesson: Creating a Simple XML Web Services Client..........................................65 

Lesson: Persisting Data..........................................................................................72 

Lab 4.2: Calling an XML Web Service .................................................................83 

Review ...................................................................................................................87

Page 4: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 4/14

iv Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET).

Module 5: Interoperating with Managed Objects 

Overview................................................................................................................. 1 

Lesson: Using .NET and COM Components in a Windows Forms Application.... 2 

Lesson: Calling Win32 APIs from Windows Forms Applications....................... 17 

Review .................................................................................................................. 28 

Lab 5.1: Interoperating with COM and Calling Win32 APIs ............................... 30 

Module 6: Printing and Reporting in Windows Forms Applications 

Overview................................................................................................................. 1 

Lesson: Printing from a Windows Forms Application............................................ 2 

Lesson: Using the Print Preview, Page Setup, and Print Dialogs ......................... 16 

Lesson: Constructing Print Document Content by Using GDI+........................... 32 

Lesson: Creating Reports by Using Crystal Reports............................................. 47 

Review .................................................................................................................. 56 

Lab 6.1: Printing Formatted Documents............................................................... 58 

Module 7: Asynchronous Programming 

Overview................................................................................................................. 1 

Lesson: The .NET Asynchronous Programming Model......................................... 2 Lesson: The Asynchronous Programming Model Design Pattern .......................... 7 

Lesson: How to Make Asynchronous Calls to Any Method................................. 19 

Lesson: Protecting State and Data in a Multithreaded Environment .................... 27 

Review .................................................................................................................. 34 

Lab 7.1: Making Asynchronous Calls to an XML Web Service........................... 36 

Module 8: Enhancing the Usability of Applications 

Overview................................................................................................................. 1 

Lesson: Adding Accessibility Features................................................................... 2 

Lesson: Adding Help to an Application.................................................................. 9 

Lesson: Localizing an Application........................................................................ 21 

Review .................................................................................................................. 34 Lab 8.1: Enhancing the Usability of an Application............................................. 37 

Course Evaluation................................................................................................. 53 

Module 9: Deploying Windows Forms Applications 

Overview................................................................................................................. 1 

Lesson: .NET Assemblies ....................................................................................... 2 

Lesson: Deploying Windows Forms Applications................................................ 24 

Review .................................................................................................................. 46 

Lab 9.1: Deploying an Application....................................................................... 48 

Module 10: Securing Windows Forms Applications 

Overview................................................................................................................. 1 

Lesson: Security in the .NET Framework............................................................... 2 Lesson: Using Code Access Security.................................................................... 14 

Lesson: Using Role-Based Security...................................................................... 29 

Review .................................................................................................................. 40 

Lab 10.1: Adding and Testing Permission Requests............................................. 42 

Course Evaluation................................................................................................. 46

Page 5: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 5/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). v

Appendix A: Using Filled Shapes and Images 

Overview..................................................................................................................1  

Lesson: Creating Brushes and Filled Shapes ...........................................................2 

Lesson: Working with Bitmap Images...................................................................14 

Page 6: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 6/14

Page 7: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 7/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). vii

About This CourseThis section provides you with a brief description of the course, audience,suggested prerequisites, and course objectives.

Windows Forms is the new platform for Microsoft® Windows® application

development, based on the Microsoft .NET Framework. The .NET Framework provides a clear, object-oriented, extensible set of classes that enablesdevelopers to develop rich Windows Forms applications. Additionally,

Windows Forms can act as the local user interface in a multi-tier distributedsolution.

This three-day instructor-led course provides students with the skills required to build Windows Forms applications by using the .NET Framework.

This course is intended for the intermediate programmer who is responsible for

designing and building Windows Forms applications by using the .NETFramework. It is designed for developers who have Microsoft Visual C#™ .NETdevelopment skills.

Typically, these individuals perform the following key activities:

  Help with creation of functional specifications

  Design and develop user interfaces

  Create and test prototypes

  Write Windows Forms applications

This course requires that students meet the following prerequisites:

  Experience with a .NET Framework language such as Visual C# .NET

Microsoft MSDN® Training Course 2609A: Introduction to C#

 Programming with Microsoft .NET and Course 2124C: Programming withC# will help students gain skills in Visual C# .NET programmingtechniques and meet the prerequisites for this course.

  Experience developing applications

After completing this course, the student will be able to:

  Create and populate Windows Forms.

  Organize controls on Windows Forms.

  Create menus in a Windows Forms application.

  Add code to form and control event procedures in a Windows Forms

application.  Create Multiple Document Interface (MDI) applications.

  Use dialog boxes in Windows Forms applications.

  Validate user input in a Windows Forms application.

  Create and use user controls in a Windows Forms application.

  Create licenses for controls.

  Bind Windows Forms applications to various data sources by using

Microsoft ADO.NET.

Description

Audience

Student prerequisites

Course objectives

Page 8: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 8/14

viii Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET).

  Consume XML Web services from Windows Forms applications.

  Use .NET and COM components in a Windows Forms application.

  Call Microsoft Win32® APIs from a Windows Forms application.

  Print documents in a Windows Forms application.

  Make asynchronous calls to methods from a Windows Forms application.

  Debug a Windows Forms application.

  Incorporate accessibility features in a Windows Forms application.

  Localize a Windows Forms application.

  Add support for help to localize a Windows Forms application.

  Create help files in a Windows Forms application.

  Deploy a Windows Forms application.

  Implement code access and role-based security in a Windows Forms

application.

  Add deployment flexibility to applications by using shared assemblies.

Page 9: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 9/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). ix

Course TimingThe following schedule is an estimate of the course timing. Your timing mayvary.

Day 1

Start End Module

9:00 9:30 Introduction

9:30 11:00 Module 1: Introducing Windows Forms 

11:00 11:10 Break

11:10 11:40 Lab 1.1: Creating Windows Forms 

11:40 12:30 Lunch

12:30 2:30 Module 2: Working with Controls 

2:30 2:45 Break

2:45 3:15 Lab 2.1: Working with Controls

3:15 4:15 Module 3: Building Controls

4:15 4:45 Lab 3.1: Building Controls

Day 2

Start End Module

8:30 9:00 Day 1 review

9:00 11:00 Module 4: Using Data in Windows Forms Applications

11:00 11:15 Break

11:15 11:45 Module 4: Using Data in Windows Forms Applications

(continued )

11:45 12:30 Lab 4.1: Accessing Data by Using ADO.NET

12:30 1:00 Lunch

1:00 1:30 Module 4: Using Data in Windows Forms Applications

(continued )

1:30 1:45 Lab 4.2: Calling an XML Web Service

1:45 2:00 Break

2:00 3:00 Module 5: Interoperating with Managed Objects

3:00 3:30 Lab 5.1: Interoperating with COM and Calling Win32 APIs

3:30 5:00 Module 6: Printing and Reporting in Windows Forms

Applications

5:00 5:45 Lab 6.1: Printing Formatted Documents

Page 10: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 10/14

x Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET).

Day 3

Start End Module

8:30 10:00 Module 7: Asynchronous Programming

10:00 10:15 Lab 7.1: Making Asynchronous Calls to an XML Web Service

10:15 10:30 Break

10:30 11:30 Module 8: Enhancing the Usability of Applications

11:30 12:15 Lunch

12:15 12:45 Lab 8.1: Enhancing the Usability of an Application

12:45 2:45 Module 9: Deploying Windows Forms Applications

2:45 3:00 Break

3:00 3:30 Lab 9.1: Deploying an Application

3:30 4:45 Module 10: Securing Windows Forms Applications

4:45 5:15 Lab 10.1: Adding and Testing Permission Requests

Page 11: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 11/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). xi

Trainer Materials Compact Disc ContentsThe Trainer Materials compact disc contains the following files and folders:

   Autorun.exe. When the compact disc is inserted into the compact disc drive,

or when you double-click the Autorun.exe file, this file opens the compact

disc and allows you to browse the Student Materials or Trainer Materialscompact disc.

   Autorun.inf. When the compact disc is inserted into the compact disc drive,

this file opens Autorun.exe.

   Default.htm. This file opens the Trainer Materials Web page.

   Readme.txt . This file explains how to install the software for viewing theTrainer Materials compact disc and its contents and how to open the Trainer

Materials Web page.

  2555A_ms.doc. This file is the Manual Classroom Setup Guide. It contains

the steps for manually setting up the classroom computers.

  2555A_sg .doc. This file is the Automated Classroom Setup Guide. It

contains a description of classroom requirements, classroom configuration,instructions for using the automated classroom setup scripts, and the

Classroom Setup Checklist.

   Powerpnt . This folder contains the Microsoft PowerPoint® slides that are

used in this course.

   Ppview. This folder contains the Microsoft PowerPoint Viewer 97, which

can be used to display the PowerPoint slides if Microsoft PowerPoint 2002is not available. Do not use this version in the classroom.

  Setup. This folder contains the files that install the course and related

software to computers in a classroom setting.

  StudentCD. This folder contains the Web page that provides students with

links to resources pertaining to this course, including additional reading,review and lab answers, lab files, multimedia presentations, and course-

related Web sites.

  Tools. This folder contains files and utilities used to complete the setup ofthe instructor computer.

  Webfiles. This folder contains the files that are required to view the courseWeb page. To open the Web page, open Windows Explorer, and in the root

directory of the compact disc, double-click Default.htm or Autorun.exe.

Page 12: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 12/14

xii Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET).

Student Materials Compact Disc ContentsThe Student Materials compact disc contains the following files and folders:

   Autorun.exe. When the compact disc is inserted into the CD-ROM drive, or

when you double-click the Autorun.exe file, this file opens the compact

disc and allows you to browse the Student Materials compact disc.   Autorun.inf. When the compact disc is inserted into the compact disc drive,

this file opens Autorun.exe.

   Default.htm. This file opens the Student Materials Web page. It providesyou with resources pertaining to this course, including additional reading,

review and lab answers, lab files, multimedia presentations, and course-

related Web sites.

   Readme.txt . This file explains how to install the software for viewing the

Student Materials compact disc and its contents and how to open the

Student Materials Web page.

  2555A_ms.doc. This file is the Manual Classroom Setup Guide. It contains a

description of classroom requirements, classroom setup instructions, and theclassroom configuration.

   Democode. This folder contains files that are used in the instructor

demonstrations.

   Flash. This folder contains the installer for the Macromedia Flash 5.0 browser plug-in.

   Fonts. This folder contains fonts that may be required to view MicrosoftWord documents that are included with this course.

   Inetpubs. This folder contains files used by the sample Web-based

applications in this course.

   Labfiles. This folder contains files that are used in the hands-on labs. These

files may be used to prepare the student computers for the hands-on labs.

   Media. This folder contains files that are used in multimedia presentations

for this course.

   Mplayer . This folder contains the setup file to install Microsoft Windows

Media™ Player.

   Practices. This folder contains files that are used in the hands-on practices.

  Sampapps. This folder contains the sample applications associated with this

course.

  Sampcode. This folder contains sample code that is accessible through the

Web pages on the Student Materials compact disc.

  Webfiles. This folder contains the files that are required to view the courseWeb page. To open the Web page, open Windows Explorer, and in the root

directory of the compact disc, double-click Default.htm or Autorun.exe.

  Wordview. This folder contains the Word Viewer that is used to view anyMicrosoft Word document (.doc) files that are included on the compact disc.

Page 13: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 13/14

  Developing Microsoft® .NET Applications for Windows® (Visual C#™ .NET). xiii

Document ConventionsThe following conventions are used in course materials to distinguish elementsof the text.

Convention Use

Bold  Represents commands, command options, and syntax that must

 be typed exactly as shown. It also indicates commands on menus

and buttons, dialog box titles and options, and icon and menu

names.

 Italic In syntax statements or descriptive text, indicates argument

names or placeholders for variable information. Italic is also

used for introducing new terms, for book titles, and for emphasis

in the text.

Title Capitals Indicate domain names, user names, computer names, directory

names, and folder and file names, except when specifically

referring to case-sensitive names. Unless otherwise indicated,

you can use lowercase letters when you type a directory name or

file name in a dialog box or at a command prompt.

ALL CAPITALS Indicate the names of keys, key sequences, and key

combinations — for example, ALT+SPACEBAR.

monospace Represents code samples or examples of screen text.

[ ] In syntax statements, enclose optional items. For example,

[ filename] in command syntax indicates that you can choose to

type a file name with the command. Type only the information

within the brackets, not the brackets themselves.

{ } In syntax statements, enclose required items. Type only the

information within the braces, not the braces themselves.

| In syntax statements, separates an either/or choice.

  Indicates a procedure with sequential steps.

... In syntax statements, specifies that the preceding item may be

repeated.

.

.

.

Represents an omitted portion of a code sample.

Page 14: 82469

8/13/2019 82469

http://slidepdf.com/reader/full/82469 14/14

 

THIS PAGE INTENTIONALLY LEFT BLANK