visual basic 2010 unleashed

1.4K 2.8K 0
visual basic 2010 unleashed

Đ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

ptg ptg Visual Basic ® 2010 UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA Alessandro Del Sole From the Library of Wow! eBook ptg Visual Basic ® 2010 Unleashed Copyright © 2010 by Pearson Education, Inc. All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein. ISBN-10: 0-672-33154-3 ISBN-13: 978-0-672-33154-1 Library of Congress Cataloging-in-Publication Data Del Sole, Alessandro. Visual Basic 2010 unleashed / Alessandro Del Sole. p. cm. Includes index. ISBN 978-0-672-33100-8 1. BASIC (Computer program language) 2. Microsoft Visual BASIC. I. Title. QA76.73.B3D467 2010 005.2'768 dc22 2010012721 Printed in the United States of America First Printing: May 2010 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Pearson Education, Inc. cannot attest to the accu- racy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possi- ble, but no warranty or fitness is implied. The information provided is on an “as is” basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book. Bulk Sales Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact: U.S. Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact: International Sales +1-317-581-3793 international@pearsontechgroup.com Editor-in-Chief Karen Gettman Executive Editor Neil Rowe Acquisitions Editor Brook Farling Development Editor Mark Renfrow Managing Editor Patrick Kanouse Project Editor Mandie Frank Copy Editor Apostrophe Editing Services Indexer WordWise Publishing Services LLC Proofreader The Wordsmithery LLC Technical Editor Matt Kleinwaks Publishing Coordinator Cindy Teeters Designer Gary Adair Compositor Mark Shirar From the Library of Wow! eBook ptg Contents at a Glance Part I Learning the Basics of VB 1 Introducing the .NET Framework 4.0 1 2 Getting Started with the Visual Studio 2010 IDE 11 3 The Anatomy of a Visual Basic Project 59 4 Data Types and Expressions 85 5 Debugging Visual Basic 2010 Applications 177 6 Handling Errors and Exceptions 207 Part II Object-Oriented Programming with Visual Basic 2010 7 Class Fundamentals 225 8 Managing an Object’s Lifetime 267 9 Organizing Types Within Namespaces 281 10 Modules 295 11 Structures and Enumerations 299 12 Inheritance 317 13 Interfaces 341 14 Generics and Nullable Types 359 15 Delegates and Events 371 16 Working with Collections 385 17 Visually Designing Objects 407 18 “Generate From Usage” Coding Techniques 421 Part III Advanced VB Language features 19 Manipulating Files and Streams 429 20 The My Namespace 451 21 Advanced Language Features 485 Part IV Data Access with ADO.NET and LINQ 22 Introducing ADO.NET and DataSets . 513 23 Introducing LINQ 523 24 LINQ to Objects 531 25 LINQ to SQL 561 26 LINQ to DataSets 595 From the Library of Wow! eBook ptg 27 Introducing ADO.NET Entity Framework 603 28 Manipulating Xml Documents with LINQ and Xml Literals 635 29 Overview of Parallel LINQ 655 Part V Building Windows Applications 30 Creating Windows Forms 4.0 Applications 665 31 Creating WPF Applications 681 32 WPF Common Controls 715 33 Brushes, Styles, Templates, and Animations in WPF 745 34 Manipulating Documents and Media 781 35 Introducing Data-Binding 799 36 Localizing Applications 829 Part VI Building Web Applications 37 Building ASP.NET Web Applications 839 38 Publishing ASP.NET Web Applications 865 39 Building Rich Internet Applications with Silverlight 871 40 Building and Deploying Applications for Windows Azure 899 Part VII Networking and Exposing Data Through Networks 41 Creating and Consuming WCF Services 927 42 Implementing and Consuming WCF Data Services 949 Part VIII Advanced .NET Framework with VB 2010 43 Serialization 971 44 Processes and Multithreading 993 45 Parallel Programming 1005 46 Working with Assemblies 1029 47 Reflection 1043 48 Coding Attributes 1065 49 Platform Invokes and Interoperability with the COM Architecture 1075 50 Documenting the Source Code 1091 51 Advanced Compilations with MSBuild 1105 52 Building Customizations for Microsoft Office 1119 Part IX Applications Deployment 53 Understanding the Global Assembly Cache . 1137 54 Setup & Deployment Projects for Windows Installer . 1145 55 Deploying Applications with ClickOnce. 1159 Visual Basic 2010 Unleashed iv From the Library of Wow! eBook ptg Part X Mastering the Visual Studio 2010 IDE 56 Advanced IDE Features . 1175 57 Introducing the Visual Studio Extensibility . 1199 58 Advanced Analysis Tools. 1223 59 Testing Code with Unit Tests, Test-Driven Development, and Code Contracts 1251 Appendixes A Installing Visual Studio 2010. 1275 B Useful Resources and Tools for Visual Basic. 1281 Index. 1285 Contents at a Glance v From the Library of Wow! eBook ptg Table of Contents Part I Learning the Basics of VB 1 Introducing the .NET Framework 4.0 1 What Is the .NET Framework?. 1 Where Is the .NET Framework . 2 The .NET Framework Architecture . 2 The Common Language Runtime . 4 Writing Managed Code 4 .NET Assemblies. 5 The Base Class Library 5 .NET Languages. 6 .NET Framework Tools . 7 Windows Software Development Kit 7 What’s New in .NET Framework 4.0 . 8 2 Getting Started with the Visual Studio 2010 IDE 11 What’s New in Visual Studio 2010 11 Start Page. 12 Get Started Tab 13 The Guidance and Resources Tab 13 The Latest News Tab 14 Working with Projects and Solutions . 15 Creating Visual Basic Projects 16 Multitargeting. 17 Accessing Recent and Online Templates 18 Searching for Installed Templates 20 Creating Reusable Projects and Items Templates 21 Creating Your First Visual Basic 2010 Project 21 Finding Visual Basic Projects. 23 Working with the Code Editor 24 Working with Tool Windows. 26 The Solution Explorer Window 27 Error List Window . 28 The Properties Window . 30 Output Window. 31 My Project . 31 Application Tab 33 From the Library of Wow! eBook ptg Compiling Projects 37 Debug and Release Configurations . 38 Other Compile Options. 41 Advanced Compile Options . 44 Debugging Overview 47 Debugging an Application 47 Breakpoints and Data Tips . 49 About Runtime Errors. 52 Edit and Continue . 53 Browsing the Visual Basic and .NET Documentation . 54 Online Help and the MSDN Library . 55 Object Browser Window. 55 3 The Anatomy of a Visual Basic Project 59 Brief Overview of Types and Members. 59 Classes 60 Properties 60 Methods 60 Modules 61 Structures 61 Inheritance 61 Namespaces 62 Accessing Members 63 Imports Directives 64 #Region #End Region Directives 64 Attributes 65 A New Feature: Implicit Line Continuation 65 Visual Basic 2010 Reserved Keywords . 67 Understanding Project Files. 70 Dissecting My Project 70 Application.MyApp . 70 AssemblyInfo.vb . 72 Resources and the Resources.resx File 73 Application Settings. 77 Understanding References . 79 Adding References to COM Libraries . 82 Deploy Without PIAs. 83 Final Considerations. 84 4 Data Types and Expressions 85 Common Type System. 85 Everything Is an Object 86 Contents vii From the Library of Wow! eBook ptg Introducing Value Types and Reference Types 86 System.Object and System.ValueType 87 Understanding Value Types. 89 .NET Framework Primitive Value Types 90 Using Value Types 92 Working with BigInteger 100 Building Custom Value Types 101 Understanding Reference Types . 101 .NET Framework Primitive Reference Types 103 Differences Between Value Types and Reference Types . 104 Memory Allocation 104 Object-Oriented Differences 107 Performance Differences 109 What Custom Type Should I Choose? 109 Converting Between Value Types and Reference Types. 110 Understanding Implicit Conversions 110 Boxing and Unboxing . 112 Deep Copy and Shallow Copy 114 The GetType Keyword 118 Conversion Operators. 119 Widening and Narrowing Conversions 119 Working with .NET Fundamental Types . 124 Working with Strings 125 Working with Dates 137 Working with Time. 143 Working with TimeZone and TimeZoneInfo 144 Working with GUIDs 147 Working with Arrays. 148 Common Operators . 155 Arithmetic Operators 155 Assignment Operators 157 Logical, Bitwise and Shift Operators 158 Concatenation Operators 163 Comparison Operators 164 Iterations, Loops, and Conditional Code Blocks . 166 Iterations 166 Loops 169 Conditional Code Blocks 171 Constants 174 With End With statement 175 Visual Basic 2010 Unleashed viii From the Library of Wow! eBook ptg 5 Debugging Visual Basic 2010 Applications 177 Preparing an Example 177 Debugging Instrumentation 178 Debugging in Steps 178 Mixed Mode Debugging 180 “Just My Code” Debugging 180 Working with Breakpoints and Trace Points 182 Locals Window . 185 Command Window . 185 Call Stack Window . 186 Watch Windows. 187 Threads Window. 189 Autos Window . 190 Debugger Visualizers 191 Debugging in Code 192 The Debug Class 192 The Trace Class 194 Understanding Trace Listeners . 195 Using Debug Attributes in Your Code 201 6 Handling Errors and Exceptions 207 Introducing Exceptions 207 Handling Exceptions 208 Are You Upgrading from Visual Basic 6? . 209 System.Exception, Naming Conventions and Specialization 209 Try Catch Finally 209 The Throw Keyword . 218 The When Keyword . 222 Catching Exceptions Without a Variable 224 Part II Object-Oriented Programming with Visual Basic 2010 7 Class Fundamentals 225 Declaring Classes. 225 Nested Classes 226 Fields . 227 Avoiding Ambiguities with Local Variables . 228 Properties. 229 Read-Only Properties 231 Write-Only Properties 231 Contents ix From the Library of Wow! eBook [...]... Custom Code Snippets 1193 57 Introducing the Visual Studio Extensibility 1199 Introducing Visual Studio Extensibility 1199 What’s New in the Extensibility with Visual Studio 2010 1200 The Visual Studio 2010 SDK 1201 From the Library of Wow! eBook xxviii Visual Basic 2010 Unleashed Building a Visual Studio Package 1201 Deploying Visual Studio Extensions .1212 Managing... xxix Appendixes A Installing Visual Studio 2010 1275 Installing Visual Studio 2010 1275 Installing the Offline Documentation .1278 Finding Additional Contents Online 1278 Running Visual Studio 2010 for the First Time .1279 B Useful Resources and Tools for Visual Basic 1281 Visual Basic Resources in MSDN .1281 Useful Developer Tools for Visual Basic 1282 Coding Tools... Visual Studio From the Library of Wow! eBook About the Author Alessandro Del Sole, a Microsoft Most Valuable Professional (MVP) for Visual Basic, is well known throughout the global VB community He is a community leader on the Italian Visual Basic Tips and Tricks” website (http://www .visual- basic. it) that serves more than 41,000 VB developers, as well as a frequent contributor to the MSDN Visual Basic. .. Publishing .866 From the Library of Wow! eBook xxii Visual Basic 2010 Unleashed MSDeploy Publish 868 Understanding Packages 868 Deploy with MSDeploy .868 39 Building Rich Internet Applications with Silverlight 871 Introducing Silverlight 871 Creating Silverlight Projects with Visual Basic 2010 872 Adding Controls and Handling Events 875 How Silverlight... he reached out to me about his interest in donating an article to the Visual Basic Developer Center on MSDN Reading his email, it was immediately apparent that Alessandro was passionate about programming and particularly the Visual Basic language With a quick Internet search I was at his blog and learning about him and the Visual Basic Tips and Tricks community Not long after we published his first... 406 17 Visually Designing Objects 407 Visual Studio Class Designer 407 Enabling the Class Designer 408 Adding and Designing Objects 409 Implementing Derived Classes 413 Creating Multiple Diagrams 416 Exporting the Diagram 416 Class View Window 417 Class Details Window 418 From the Library of Wow! eBook xiv Visual Basic 2010 Unleashed. .. technology because it is composed of several parts such as libraries, executable tools, and relationships and integrates with the operating system Microsoft Visual Studio 2010 relies on the new version of the NET Framework 4.0 Visual Basic 2010, C# 4.0, and F# 2010 are NET languages that rely on and can build applications for the NET Framework 4.0 The new version of this technology introduces important new... Language Integrated Query (LINQ), data became much easier to work with and Visual Basic s support for LINQ is extremely full featured with its set of expanded query operators and easy to use language syntax Coupled with the latest features in 2010 like implicit line continuation and multiline and statement lambdas makes Visual Basic one of the premiere modern programming languages of today Millions of... the eyes of a Visual Basic developer If you’re just learning the platform this is a great place to start as Alessandro begins with the basics of the platform and the language, and then touches on a variety of different application development technologies and techniques If you’re already programming on the NET platform, then this book will show you what’s new, not only in the Visual Basic language,... eBook xxvi Visual Basic 2010 Unleashed 51 Advanced Compilations with MSBuild 1105 Introducing MSBuild .1105 Introducing Projects 1107 Understanding Tasks and Creating Targets 1111 Advanced MSBuild Features 1114 Batching 1114 Logging 1116 Transformations .1116 52 Building Customizations for Microsoft Office 1119 Introducing the Visual Studio . ptg ptg Visual Basic ® 2010 UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA Alessandro Del Sole From the Library of Wow! eBook ptg Visual Basic ® 2010 Unleashed Copyright © 2010. Alessandro. Visual Basic 2010 unleashed / Alessandro Del Sole. p. cm. Includes index. ISBN 978-0-672-33100-8 1. BASIC (Computer program language) 2. Microsoft Visual BASIC. I. Title. QA76.73.B3D467 2010 005.2'768. ClickOnce. 1159 Visual Basic 2010 Unleashed iv From the Library of Wow! eBook ptg Part X Mastering the Visual Studio 2010 IDE 56 Advanced IDE Features . 1175 57 Introducing the Visual Studio Extensibility

Ngày đăng: 01/08/2014, 16:22

Từ khóa liên quan

Mục lục

  • Table of Contents

  • Part I: Learning the Basics of VB

    • 1 Introducing the .NET Framework 4.0

      • What Is the .NET Framework?

      • The Common Language Runtime

      • The Base Class Library

      • .NET Languages

      • .NET Framework Tools

      • What's New in .NET Framework 4.0

      • 2 Getting Started with the Visual Studio 2010 IDE

        • What's New in Visual Studio 2010

        • Start Page

        • Working with Projects and Solutions

        • Working with Tool Windows

        • My Project

        • Compiling Projects

        • Debugging Overview

        • Browsing the Visual Basic and .NET Documentation

        • 3 The Anatomy of a Visual Basic Project

          • Brief Overview of Types and Members

          • Visual Basic 2010 Reserved Keywords

          • Understanding Project Files

          • Understanding References

          • 4 Data Types and Expressions

            • Common Type System

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan