The Book of Visual Studio - Lagout.org

The Book of Visual Studio .NET¡ªA Guide

for Developers

Robert B. Dunaway

NO STARCH PRESS

San Francisco

Copyright ? 2002 Robert B. Dunaway

All rights reserved. No part of this work may be reproduced or transmitted in any form or by

any means, electronic or mechanical, including photocopying, recording, or by any

information storage or retrieval system, without the prior written permission of the copyright

owner and the publisher.

1 2 3 4 5 6 7 8 9 10-05 04 03 02

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press,

Inc. Other product and company names mentioned herein may be the trademarks of their

respective owners. Rather than use a trademark symbol with every occurrence of a

trademarked name, we are using the names only in an editorial fashion and to the benefit of

the trademark owner, with no intention of infringement of the trademark.

Publisher: William Pollock

Editorial Director: Karol Jurado

Cover and Interior Design: Octopod Studios

Composition: 1106 Design, LLC

Developmental Editor: William Pollock

Copyeditor: Kenyon Brown

Proofreader: Mei Levenson

Indexer: Broccoli Information Management

Distributed to the book trade in the United States by Publishers Group West, 1700 Fourth

Street, Berkeley, CA 94710; phone: 800-788-3123; fax: 510-658-1834.

Distributed to the book trade in Canada by Jacqueline Gross & Associates, Inc., One Atlantic

Avenue, Suite 105, Toronto, Ontario M6K 3E7 Canada; phone: 416-531-6737; fax 416-5314259.

For information on translations or book distributors outside the United States and Canada,

please contact No Starch Press, Inc. directly:

No Starch Press, Inc.

555 De Haro Street, Suite 250, San Francisco, CA 94107

phone: 415-863-9900; fax: 415-863-9950; info@;

The information in this book is distributed on an "As Is" basis, without warranty. While every

precaution has been taken in the preparation of this work, neither the author nor No Starch

Press, Inc. shall have any liability to any person or entity with respect to any loss or damage

caused or alleged to be caused directly or indirectly by the information contained in it.

Library of Congress Cataloguing-in-Publication Data

Dunaway, Robert B.

The book of Visual Studio .NET/Robert B. Dunaway.

p. cm.

Includes index.

1-886411-69-7

(pbk.)

1. Microsoft Visual Studio. 2. framework. 3. Web

site development--Computer programs. I. Title.

TK5105.8885.M57 D86 2002

005.2'76--dc21 2001030346

Dedication

To Tamarah:

Your steadfast love has inspired me to become a better man.

I love you.

To my Grandfather:

The principles and love you have shown me remain.

I miss you.

ACKNOWLEDGMENTS

This book is the product of a combined effort. My thanks to all involved at No Starch Press.

I would like to thank Bill Pollock for believing in me as a first time writer and for his patience

throughout the writing of this book. Thank you for the countless hours you spent guiding and

editing my work so that it would be more enjoyable and understandable to read.

Special thanks to Karol Jurado, the Editorial Director, for coordinating the entire effort and

fielding my many questions. You've help make this an experience I would like to repeat.

I would also like to thank Ken Brown, the copyeditor, and Mei Levenson, our proofreader. I

know that catching my grammatical errors is no trivial task.

Special thanks to William H. Bennethum, whose friendship, criticism, and encouragement

means the world to me. Your comments and insight concerning this book have been

invaluable.

Thanks to Cheryl and Jeffery Dunaway, for your love and for teaching me that nothing was

out of my reach.

Thanks to Michael and Cathy Browning, for your guidance in my career and your continued

support.

Special thanks to my Grandmother, Maude Jump, for your continued love and support.

Robert B. Dunaway

Cincinnati, Ohio

Introduction: Introducing .NET

When designing the contents, format, and general layout of this book, the challenges that

developers face when implementing Microsoft .NET technologies were considered. The .NET

initiative offers both a new set of technologies and a new paradigm for development, because

it is not only a development environment but also an entire suite of servers and services that

work together to deliver solutions to solve today's business problems. The book could have

perhaps more easily addressed a single vertical portion of the .NET suite of technologies, but

then how would you know how or where that portion fits into .NET model, and how could

you take advantage of other services that are provided by the vast set of .NET technologies?

The truth is that you probably could not.

One book simply cannot adequately cover all of the technologies that are required to deliver a

complete .NET solution. .NET encompasses several new technologies, including new

versions and enhancements of nearly every current technology. These products include SQL

Server, Windows XP, .NET Enterprise Server, and industry-standard technologies such as

XML and SOAP.

This book provides you with a solid understanding of Visual Studio .NET and of how to use it

to implement a variety of .NET solutions (a considerable challenge, given the number of

technologies that make up the .NET framework). You'll focus mainly on Visual Studio 7

.NET, while still getting an overview of several .NET-related technologies. In fact, you'll get

quite a bit more than a simple overview of Visual Studio .NET and related technologies;

you'll learn exactly where each technology fits into the big picture of .NET, and you'll run

sample code that demonstrates your ability to take advantage of that technology today! Good

luck and enjoy.

Level of Expertise

The Book of Visual Studio .NET assumes that you are familiar with Windows-based

programming, object-oriented programming, Windows 2000 Advanced Server, Windows XP,

or .NET Enterprise Server. It will also be helpful for you to understand SQL Server, COM,

and COM+ because they are required to build a scalable and reliable Windows DNA

application. Knowing these technologies will make the transition to the .NET Framework

easier for you to handle. While the book assumes this knowledge, it will discuss much of this

technology throughout because of the way .NET integrates it to build business solutions. If

you are lacking in any one of these areas, do not fear; you won't be by the time you finish this

book.

Note While many of the examples are written in Visual Basic (VB), and the book has

included a chapter on Visual Basic .NET, don't expect to learn Visual Basic .NET here.

If you already know Visual Basic, you will be better able to take advantage of these

code examples. If not, you will get an introduction to areas of Visual Basic .NET that

you will need to explore in a book that is geared more toward learning the Visual Basic

.NET language.

Who Should Read This Book?

This book is only a starting point for understanding the .NET suite of technologies, which is

essential for any successful .NET delivery. Once you are finished with this book, you will be

able to relate whatever you are doing to some portion of the .NET framework.

The Book of Visual Studio .NET is for intermediate and advanced developers who want to

build scalable, reliable, flexible, and manageable systems using Visual Studio .NET. If you

are a developer, an architect, or a manager of a software development team, this book is for

you.

You will also find this book helpful if you aspire to become a software architect with an

understanding of how the pieces of .NET technology fit together to form a business solution.

Finally, while every development manager does not need to understand the details of

COM+/Enterprise Services, , , or SOAP/Web Services, an understanding

of the issues that are involved in integrating multiple .NET technologies will enable you to

better lead your team. You will be better prepared to deal with the complexities of the next

wave of software development for both the Internet and the desktop.

Goals of This Book

This book does not take an exhaustive look at any one language or technology. While you will

gain new insights into these technologies, you will not learn the technologies themselves.

You will, however, learn to use Visual Studio .NET to implement a variety of .NET

technologies as we take an exhaustive look at the .NET Framework. The book covers many

new and updated .NET tools (with tutorial-like examples of how to use them). As you learn,

you will see, in great detail, the process of building compiled components has significantly

changed compared to how classic COM has been implemented. The book also discusses how

languages have been enhanced and DLLs changed. Finally, the book examines a variety of

nuances introduced by .NET and Visual Studio .NET.

By the end of this book, you should have a firm grasp on what this new world of .NET

development technology is all about. You will be able to answer the question, "What is

.NET?" with confidence, and communicate the benefits of .NET. But more importantly, you

will be able to use all of the .NET tools and implement other .NET technologies by using

Visual Studio .NET.

Chapter 1: Why .NET

.NET, like any other technology, must be carefully evaluated before an educated decision can

be made concerning its use. Before we continue discussing the values of .NET we will briefly

look at how problems can be solved using .NET.

Business Problems Addressed by .NET

Many Internet solutions have been patterned after the mainframe's centralized model. New

technologies in the PC world, such as transaction support and messaging, are mature

technologies in the mainframe world, and in many ways, the mainframe has paved the way for

the Internet. However, it is important to understand that the mainframe, while incorporating

many technologies, leans toward centralization. In this chapter we will cover key architectural

designs leading to today's application designs as they are implemented using .NET.

In many ways, the PC world itself has made a few paradigm shifts as it has moved from

computing on separate, unconnected workstations to the PC network and a client/server

relationship. Network file and print servers provided a way to share information and a single

point of administration. The addition of file services turned the PC into an application server.

The birth of client/server computing helped to reduce the workload on the client PC and to

increase performance and reliability. Rather than relying on the client application to

manipulate and manage its own e-mail files, services ensures that the client's responsibilities

are limited to requests and replies while the server does the work, thus improving reliability

because the PC could no longer damage its own data in the event of a crash.

The first PC networks involved file and print servers with a centralized means of sharing

information and a single point of administration, as shown in Figure 1-1. The server simply

serves the files required to run an application. This is a client/server model only in the context

of file and print services; the application itself isn't really a true client/server application, and

it only takes advantage of certain client/server services that are needed to run the application

from a central location.

Figure 1-1: This diagram represents the old client-controlled model.

The problems with this centralized computing model range from loss of performance to data

corruption. Performance is slow because the client application must do all the work necessary

to make the application functional, with the network as intermediary. Due to the ever-present

risk of client instability, the potential for data corruption is also high. If the client fails while

handling files on the file server, it can easily corrupt application or data files.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download