1. Trang chủ
  2. » Công Nghệ Thông Tin

Professional VB 2005 - 2006 phần 1 pot

110 286 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 110
Dung lượng 5,99 MB

Nội dung

TEAM LinG Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Professional VB 2005 01_575368 ffirs.qxd 10/7/05 10:46 PM Page i Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 01_575368 ffirs.qxd 10/7/05 10:46 PM Page ii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Professional VB 2005 Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon 01_575368 ffirs.qxd 10/7/05 10:46 PM Page iii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Professional VB 2005 Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-7645-7536-5 ISBN-10: 0-7645-7536-8 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SW/RQ/QV/IN Library of Congress Cataloging-in-Publication Data: Professional Visual Basic 2005 / Bill Evjen [et al.]. p. cm. Includes index. ISBN-13: 978-0-7645-7536-5 (paper/website) ISBN-10: 0-7645-7536-8 (paper/website) 1. Microsoft Visual BASIC. 2. BASIC (Computer program language) 3. Microsoft .NET. I. Evjen, Bill. QA76.73.B3P7485 2005 005.2’768 — dc22 2005012585 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESEN- TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WAR- RANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUIT- ABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade- marks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Visual Basic is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. 01_575368 ffirs.qxd 10/7/05 10:46 PM Page iv Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com About the Authors Bill Evjen is an active proponent of .NET technologies and community-based learning initiatives for .NET. He has been actively involved with .NET since the first bits were released in 2000. In the same year, Bill founded the St. Louis .NET User Group ( www.stlnet.org), one of the world’s first .NET user groups. Bill is also the founder and the executive director of the International .NET Association (INETA – www.ineta.org), which represents more than 375,000 members worldwide. Based in St. Louis, Missouri, Bill is an acclaimed author and speaker on ASP.NET and XML Web Services. He has written or coauthored more than 10 books, including Professional C# 2005 and Professional ASP.NET 2.0 (Wrox), XML Web Services for ASP.NET, ASP.NET Professional Secrets (Wiley), and more. Bill is a technical director for Reuters, the international news and financial services company, and he travels the world speaking to major financial institutions about the future of the IT industry. He gradu- ated from Western Washington University in Bellingham, Washington, with a Russian language degree. When he isn’t tinkering on the computer, he can usually be found at his summer house in Toivakka, Finland. You can reach Bill at evjen@yahoo.com. To Kalle – Welcome to the family! Billy Hollis is coauthor of the first book ever published on Visual Basic .NET, VB.NET Programming on the Public Beta (Wrox Press) as well as numerous other books and articles on .NET. Billy is a Microsoft regional director and an MVP, and he was selected as one of the original .NET “Software Legends.” He writes a monthly column for MSDN Online and is heavily involved in training, consultation, and soft- ware development on the Microsoft .NET platform, focusing on smart-client development and commer- cial packages. He frequently speaks at industry conferences such as Microsoft’s Professional Developer Conference, TechEd, and COMDES. Billy is a member of the INETA speakers’ bureau and speaks at user group meetings all over the United States. Rockford Lhotka is the principal technology evangelist for Magenic Technologies ( www.magenic.com), a company focused on delivering business value through applied technology and one of the nation’s premiere Microsoft Gold Certified Partners. Rockford is the author of several books, including Expert Visual Basic .NET and C# Business Objects. He is a Microsoft Software Legend, regional director, MVP, and INETA speaker. He is a columnist for MSDN Online and contributing author for Visual Studio Magazine, and he regularly presents at major conferences around the world — including Microsoft PDC, Tech Ed, VS Live! and VS Connections. For more information go to www.lhotka.net. For my Mom and Dad, whose love and guidance have been invaluable in my life. Thank you! Tim McCarthy is a principal engineer at InterKnowlogy, where he architects and builds highly scalable n-tier web and smart-client applications utilizing the latest Microsoft platforms and technologies. Tim’s expertise covers a wide range of Microsoft technologies, including, but not limited to: .NET Framework (ASP.NET/Smart Clients/Web Services), Active Directory, UDDI, SQL Server, Windows SharePoint Services/SharePoint Portal Server 2003, and Service Oriented Architecture (SOA) applications. Tim has worked as a project technical lead/member as well as in a technical consulting role for several Fortune 500 companies. He has held the Microsoft Certified Solution Developer (MCSD) and Microsoft Certified Trainer (MCT) certifications for several years and was one of the first wave of developers to earn the Microsoft Certified Application Developer (MCAD) for .NET and MCSD for .NET certifications. He also holds the Microsoft Certified Database Administrator certification for SQL Server 2000. 01_575368 ffirs.qxd 10/7/05 10:46 PM Page v Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Tim has been an author and technical reviewer for several books from Wrox Press and most recently was a lead author on Professional VB.NET 2003. His other books include Professional Commerce Server 2000, and Professional ADO 2.5 Programming. Tim is currently working as a lead author on the next edition of Professional VB.NET. Tim has written numerous articles for the Developer .NET Update newsletter, devel- oped packaged presentations for MSDN, and has written a whitepaper for Microsoft on using COM+ services in .NET. He has also written articles for SQL Server Magazine and Windows & .NET Magazine. Tim has spoken at technical conferences around the world and several San Diego area user groups (includ- ing both .NET and SQL Server groups) and he has been a regular speaker at the Microsoft Developer Days conference in San Diego for the last several years. Tim has also delivered MSDN webcasts, many of which were repeat requests from Microsoft. Tim also teaches custom .NET classes to companies in need of expert .NET mentoring and training. Tim holds a B.B.A. in marketing from the Illinois Institute of Technology as well as an M.B.A. in market- ing from National University. Before becoming an application developer, Tim was an officer in the United States Marine Corps. Tim’s passion for .NET is only surpassed by his passion for Notre Dame athletics. I dedicate this book to everybody in my family who supports me. Jasmine, some day you will be writing books, too! Rama Ramachandran is a software architect at DKR Capital, a major hedge fund company in Stamford, Connecticut. He is a Microsoft Certified Solutions Developer and Site-Builder and has excelled in designing and developing WinForms and Web applications using .NET, ASP.NET, Visual Basic and SQL Server. Rama has more than 15 years’ experience with all facets of the software development lifecycle and has cowritten Introducing .NET, Professional ASP Data Access, Professional Visual InterDev Programming (all Wrox Press), and four books on classic Visual Basic. Rama is also the “ASP Pro” at Devx.com, where he maintains ASP-related columns. He teaches .NET Development and Web Development for Fairfield University’s master’s degree in software engineering, and at the University of Connecticut. You can reach Rama at ramabeena@hotmail.com. This book is dedicated to my wife, Beena, and our children, Ashish and Amit. They make my life whole. I’m great at writing about technology but get tongue-tied trying to say how much I love and care about the three of you. I am grateful to our prayer-answering God for your laughing, mischievous, adoring lives. Thanks for being there, Beens. I love you. Kent Sharkey. Born in an igloo and raised by wolves in a strange realm called “Manitoba,” Kent Sharkey wandered the wilderness until found by a group of kind technical evangelists and migrated to Redmond. He now is content strategist (yeah, he doesn’t know what he’s supposed to do either) for ASP.NET content on MSDN. When not answering email he dreams of sleeping, complains to everyone around (come to think of it, he does that while answering email as well), and attempts to keep his house- mates (Babi, Cica, and Squirrel) happy. As with all else, to Margaret. Thank you. Bill Sheldon is a software architect and engineer originally from Baltimore, Maryland. Holding a degree in Computer Science from the Illinois Institute of Technology (IIT) and a Microsoft Certified Solution Developer (MCSD) qualification, Bill has been employed as an engineer since resigning his commission with the U.S. Navy following the first Gulf War. Bill is involved with the San Diego .NET User Group and writes for Windows and .NET magazines, including the twice monthly Developer .NET Update email newsletter. He is also a frequent online presenter for MSDN and speaks at live events such as Microsoft Developer Days. He lives with his wife, Tracie, in Southern California, where he is employed as a princi- pal engineer with InterKnowlogy. You can reach Bill at bills@interknowlogy.com. 01_575368 ffirs.qxd 10/7/05 10:46 PM Page vi Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Credits Acquisitions Editor Katie Mohr Development Editors Eileen Bien Calabro Ami Frank Sullivan Technical Editor Brian Patterson Production Editor Pamela Hanley Copy Editor Foxxe Editorial Services Editorial Manager Mary Beth Wakefield Vice President & Executive Group Publisher Richard Swadley Vice President and Publisher Joseph B. Wikert Project Coordinator Ryan Steffen Graphics and Production Specialists Carrie A. Foster Lauren Goddard Denny Hager Barbara Moore Lynsey Osborn Alicia South Quality Control Technicians Laura Albert John Greenough Leeann Harney Jessica Kramer Brian H. Walls Proofreading TECHBOOKS Production Services Indexing Broccoli Information Management 01_575368 ffirs.qxd 10/7/05 10:46 PM Page vii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 01_575368 ffirs.qxd 10/7/05 10:46 PM Page viii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Contents Introduction xxv Chapter 1: What Is Microsoft .NET? 1 What Is .NET? 1 A Broad and Deep Platform for the Future 2 What’s Wrong with DNA and COM? 2 An Overview of the .NET Framework 3 The Common Language Runtime 4 Key Design Goals 5 Metadata 7 Multiple-Language Integration and Support 7 A Common Type System 8 Namespaces 8 The Next Layer — The .NET Class Framework 8 What Is in the .NET Class Framework? 9 User and Program Interfaces 10 Windows Forms 11 Web Forms 11 Console Applications 12 Web Services 12 XML as the .NET Metalanguage 12 The Role of COM 13 No Internal Use of COM 13 Some Things Never Change . . . 13 .NET Drives Changes in Visual Basic 14 How .NET Affects You 14 A Spectrum of Programming Models 14 Reducing Barriers to Internet Development 15 Libraries of Prewritten Functionality 15 Easier Deployment 15 The Future of .NET 16 Major Differences in .NET 2.0 16 Summary 17 02_575368 ftoc.qxd 10/7/05 10:47 PM Page ix Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com [...]... Elements of a NET Application Modules Assemblies Types 80 80 81 83 84 84 85 88 88 90 90 90 94 94 11 4 11 5 11 6 11 6 11 9 12 0 12 5 12 8 13 3 13 4 13 7 13 8 14 0 18 7 18 7 18 9 19 5 19 7 19 8 19 8 19 9 200 xi Contents Versioning and Deployment Better Support for Versioning Better Deployment Simpo PDF Merge and Integration Cross-Language Split Unregistered Version - http://www.simpopdf.com The Common Type System Metadata Better... Object in VB6 Structured-Exception-Handling Keywords in VB. NET 287 289 2 91 292 293 294 295 298 299 303 307 308 308 308 309 311 312 314 314 315 315 The Try, Catch, and Finally Keywords The Throw Keyword Throwing a New Exception The Exit Try Statement Nested Try Structures The Message Property The InnerException and TargetSite Properties 316 318 319 320 3 21 323 323 Interoperability with VB6 -Style Error... WebClient Creating Your Own Web Server with HttpListener Summary xxii 902 905 906 907 910 910 911 912 912 914 914 915 916 917 919 919 9 21 922 922 923 927 927 929 9 31 9 31 933 934 934 935 935 952 955 963 Contents Chapter 27: Visual Basic and the Internet Downloading Internet Resources Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Sockets Building the Application Creating Conversation... 696 698 698 710 711 714 719 722 723 726 729 732 733 733 735 745 745 747 748 749 749 752 754 755 756 7 61 7 61 763 766 766 767 769 772 772 xix Contents Chapter 21: Enterprise Services Transactions Simpo PDF MergeTest Split Unregistered Version - http://www.simpopdf.com The ACID and Transactional Components 773 774 774 775 An Example of Transactions 776 Other Aspects of Transactions 7 91 Just-In-Time Object... 507 508 509 509 510 511 511 513 517 520 520 523 526 528 5 31 533 535 538 539 543 543 543 544 545 547 549 5 51 552 552 553 553 554 554 554 555 559 560 560 564 564 565 Simpo PDF Contents A Composite UserControl Creating a Composite UserControl How Does Resize Work? Merge Setting a Minimum Size and Split Unregistered Version Exposing Properties of Subcontrols Stepping Through the Example 566 - http://www.simpopdf.com... Applications Windows Forms and HTML — No Problem! Summary 965 965 969 970 972 980 986 990 9 91 1000 Appendix A: The Visual Basic Compiler 10 01 Appendix B: Visual Basic Resources 10 17 Index 10 19 xxiii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Introduction Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com In 2002, Visual Basic took the biggest leap in innovation... Fragile Base Class Issue Summary Chapter 8: Generics Using Generics 2 01 2 01 202 203 203 204 205 206 208 209 210 211 218 220 222 223 223 227 230 230 230 2 41 242 246 252 254 257 259 260 Generic Types Generic Methods 2 61 265 Creating Generics 267 Generic Types Generic Methods Constraints Generics and Late Binding Summary xii 267 275 276 280 2 81 Contents Chapter 9: Namespaces 283 What Is a Namespace? 284 Simpo... 809 809 811 811 812 812 815 820 822 823 825 827 834 Chapter 23: XML Web Services 835 Introduction to Web Services Early Architectural Designs 835 837 The Network Angle Application Development Merging the Two with the Web The Foundations of Web Services xx 837 837 837 838 Contents The Problems The Other Players What All the Foundations Missed Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com... Chapter 18 : Assemblies Assemblies The Manifest The Identity Section Referenced Assemblies Assemblies and Deployment Application-Private Assemblies Shared Assemblies Versioning Issues Application Isolation Side-by-Side Execution Self-Describing Version Policies Configuration Files Dynamic Loading of Assemblies The Assembly Class Putting Assemblies to Work Summary 6 71 672 673 675 677 678 678 679 6 81 6 81 682... among Web Forms A Final Example Summary Chapter 17 : ASP.NET 2.0 Advanced Features Applications and Pages Cross-Page Posting ASP.NET Advanced Compilation 590 5 91 593 594 596 598 598 600 602 604 605 606 607 608 609 611 611 625 627 627 628 632 xvii Contents Master Pages Simpo Creating a Master Page Creating the Content Page PDF Mergethe Master Page Application-Wide Declaring and Split Unregistered Version . 46256 www.wiley.com Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN -1 3 : 97 8-0 -7 64 5-7 53 6-5 ISBN -1 0 : 0-7 64 5-7 53 6-8 Manufactured in the United States of America 10 9. 6 5 4 3 2 1 1B/SW/RQ/QV/IN Library of Congress Cataloging-in-Publication Data: Professional Visual Basic 2005 / Bill Evjen [et al.]. p. cm. Includes index. ISBN -1 3 : 97 8-0 -7 64 5-7 53 6-5 (paper/website) ISBN -1 0 :. Methods 11 4 Termination and Cleanup 11 5 Advanced Concepts 11 6 Overloading Methods 11 6 Overloading Constructor Methods 11 9 Shared Methods, Variables, and Events 12 0 Operator Overloading 12 5 Delegates

Ngày đăng: 12/08/2014, 23:23