Apress Beginning Object-Oriented ASP.NET 2.0 with VB.NET, From Novice to Professional (2005).pdf

(3780 KB) Pobierz
Beginning Object-Oriented
ASP.NET 2.0 with VB.NET
From Novice to
Professional
Brian R. Myers
1015591302.018.png 1015591302.019.png 1015591302.020.png 1015591302.021.png 1015591302.001.png 1015591302.002.png 1015591302.003.png 1015591302.004.png 1015591302.005.png 1015591302.006.png 1015591302.007.png
Beginning Object-Oriented ASP.NET 2.0 with VB.NET: From Novice to Professional
Copyright © 2005 by Brian R. Myers
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.
ISBN (pbk): 1-59059-538-6
Printed and bound in the United States of America 987654321
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Jonathan Hassell
Technical Reviewers: Ron Landers, Martin W.P. Reid
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis,
Jason Gilmore, Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser
Associate Publisher: Grace Wong
Project Manager: Kylie Johnston
Copy Edit Manager: Nicole LeClerc
Copy Editor: Julie M. Smith
Assistant Production Director: Kari Brooks-Copony
Production Editor: Ellie Fountain
Compositor: Linda Weidemann, Wolf Creek Press
Proofreaders: Elizabeth Berry and Linda Seifert
Indexer: Carol Burbo
Artist: Kinetic Publishing Services, LLC
Interior Designer: Van Winkle Design Group
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com , or
visit http://www.springeronline.com .
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com , or visit http://www.apress.com .
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress 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 this work.
 
1015591302.008.png 1015591302.009.png
This book is dedicated to my dad, Donald Myers Jr.,
who helped me understand the value of work
and who thought I should “do something
in computers.” I am very glad I took that advice.
In Loving Memory of Donald Myers Jr.
February 18, 1945–April 23, 1998
 
1015591302.010.png 1015591302.011.png
Contents at a Glance
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
CHAPTER 1
An Introduction to .NET and Visual Studio 2005 . . . . . . . . . . . . . . . . . . 1
CHAPTER 2
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
CHAPTER 3
Attributes and Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
CHAPTER 4
Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CHAPTER 5
Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
CHAPTER 6
Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
CHAPTER 7
Class Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
CHAPTER 8
ASP.NET Web Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
CHAPTER 9
ASP.NET Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
CHAPTER 10
Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
v
1015591302.012.png 1015591302.013.png 1015591302.014.png
Contents
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
An Introduction to .NET and Visual Studio 2005 . . . . . . . . . . . 1
CHAPTER 1
VB.NET and ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
An Introduction to Microsoft .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Common Language Runtime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
An Introduction to Visual Studio 2005 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
How to Get Started with Visual Studio 2005 . . . . . . . . . . . . . . . . . . . . . 4
Creating a New Web Project (ASP.NET) . . . . . . . . . . . . . . . . . . . . . . . . . 6
Opening an Existing Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Building Web Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Accessing a Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Navigating the Visual Studio Environment . . . . . . . . . . . . . . . . . . . . . 21
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
IntelliSense . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
CHAPTER 2
Introduction to OOP Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Why Objects Exist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Objects As the Building Blocks of OOP . . . . . . . . . . . . . . . . . . . . . . . . 29
Introduction to Reusability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
vii
1015591302.015.png 1015591302.016.png 1015591302.017.png
Zgłoś jeśli naruszono regulamin