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

Apress pro VB 2008 and the dot NET 3 5 platform 3rd edition mar 2008 ISBN 1590598229 pdf

1,4K 385 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 1.409
Dung lượng 25,87 MB

Nội dung

 CYAN   MAGENTA  YELLOW   BLACK  PANTONE 123 C Books for professionals by professionals ® The EXPERT’s VOIce ® in NET Companion eBook Available Pro VB 2008 and the NET 3.5 Platform Dear Reader, Pro C# 2008 and the NET 3.5 Platform, Fourth Edition COM and NET Interoperability Expert ASP.NET 2.0 Advanced Application Design Developer’s Workshop to COM and ATL 3.0 Andrew Troelsen Microsoft MVP, Visual Developer—Visual C# Companion eBook THE APRESS ROADMAP Accelerated SQL Server 2008 Beginning VB 2008 See last page for details on $10 eBook version SOURCE CODE ONLINE www.apress.com Accelerated VB 2008 Pro VB 2008 and the NET 3.5 Platform Beginning VB 2008 Databases Visual Basic 2008 Recipes Pro WPF with VB 2008 2008 and the NET 3.5 Platform Take care and enjoy, Pro VB Author of The first edition of this book was released shortly after the 2001 Tech·Ed conference in Atlanta, Georgia The latest edition of this text is a massive upgrade from the book’s prior editions that accounts for all of the new features found within NET 3.0 and NET 3.5 As you may know, NET 3.0 did not change the syntax of VB, but was simply an “augmentative release,” essentially providing three new APIs: Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), and Windows Workflow Foundation (WF) As you would expect, coverage of the “W’s” is included in the book you hold in your hands Unlike NET 3.0, NET 3.5 provides dozens of new VB language features and new NET APIs This edition of the book will walk you through all of this new material using the same readable approach (at least that is what I have been told!) as found in the prior editions Rest assured, you’ll find detailed coverage of Language Integrated Query (LINQ), the VB 2008 language changes (object initialization syntax, extension methods, anonymous types, etc.), and the numerous bells and whistles of Visual Studio 2008 The mission of this text is to provide you with a rock-solid foundation of the VB 2008 language and object-oriented programming techniques, as well as the core aspects of the NET platform Once you digest the information presented in these 35 chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well equipped to explore the NET universe on your own terms ISBN-13: 978-1-59059-822-1 ISBN-10: 1-59059-822-9 55999 US $59.99 Troelsen Pro VB 2008 and the NET 3.5 Platform Exploring the NET universe with Visual Basic 2008 Andrew Troelsen Shelve in Programming/Microsoft/.NET User level: Intermediate–Advanced 781590 598221 this print for content only—size & color not accurate spine = 2.061" 1,408 page count 8229FM.qxd 3/5/08 4:23 PM Page i Pro VB 2008 and the NET 3.5 Platform Andrew Troelsen 8229FM.qxd 3/5/08 4:23 PM Page ii Pro VB 2008 and the NET 3.5 Platform Copyright © 2008 by Andrew Troelsen 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-13 (pbk): 978-1-59059-822-1 ISBN-10 (pbk): 1-59059-822-9 ISBN-13 (electronic): 978-1-4302-0200-4 ISBN-10 (electronic): 1-4302-0200-9 Printed and bound in the United States of America 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: Ewan Buckingham Technical Reviewer: Andy Olsen Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Production Director and Project Manager: Grace Wong Senior Copy Editor: Ami Knox Copy Editor: Nicole Flores Associate Production Director: Kari Brooks-Copony Production Editor: Laura Esterman Compositor: Dina Quan Artist: April Milne Proofreaders: April Eddy, Linda Seifert, Liz Welch Indexer: Broccoli Information Management Cover Designer: Kurt Krames Manufacturing Director: 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 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales 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 The source code for this book is available to readers at http://www.apress.com in the Source Code section You may need to answer questions pertaining to this book in order to successfully download the code 8229FM.qxd 3/5/08 4:23 PM Page iii To my Grandmother, Maxine Hey Lady! I honestly don’t think I’ve ever met a stronger woman You are a rock, Gerta Love ya 8229FM.qxd 3/5/08 4:23 PM Page iv Contents at a Glance About the Author xix About the Technical Reviewer xix Acknowledgments xx Introduction and Welcome xxi PART Introducing Visual Basic 2008 and the NET Platform ■CHAPTER The Philosophy of NET ■CHAPTER Building Visual Basic 2008 Applications 35 PART ■■■ Core VB Programming Constructs ■CHAPTER VB 2008 Programming Constructs, Part I 65 ■CHAPTER VB 2008 Programming Constructs, Part II 103 ■CHAPTER Designing Encapsulated Class Types 129 ■CHAPTER Understanding Inheritance and Polymorphism 173 ■CHAPTER Understanding Structured Exception Handling 207 ■CHAPTER Understanding Object Lifetime 233 PART iv ■■■ ■■■ Advanced VB Programming Constructs ■CHAPTER Working with Interface Types 255 ■CHAPTER 10 Collections, Generics, and Nullable Data Types 291 ■CHAPTER 11 Delegates, Events, and Lambdas 327 ■CHAPTER 12 Operator Overloading and Custom Conversion Routines 359 ■CHAPTER 13 VB 2008–Specific Language Features 383 ■CHAPTER 14 An Introduction to LINQ 409 8229FM.qxd 3/5/08 4:23 PM PART Page v ■■■ Programming with NET Assemblies ■CHAPTER 15 Introducing NET Assemblies 437 ■CHAPTER 16 Type Reflection, Late Binding, and Attribute-Based Programming 483 ■CHAPTER 17 Processes, AppDomains, and Object Contexts 517 ■CHAPTER 18 Building Multithreaded Applications 537 ■CHAPTER 19 NET Interoperability Assemblies 571 PART ■■■ Introducing the NET Base Class Libraries ■CHAPTER 20 File and Directory Manipulation 607 ■CHAPTER 21 Introducing Object Serialization 633 ■CHAPTER 22 ADO.NET Part I: The Connected Layer 653 ■CHAPTER 23 ADO.NET Part II: The Disconnected Layer 705 ■CHAPTER 24 Programming with the LINQ APIs 759 ■CHAPTER 25 Introducing Windows Communication Foundation 795 ■CHAPTER 26 Introducing Windows Workflow Foundation 843 PART ■■■ Desktop Applications with Windows Forms ■CHAPTER 27 Introducing Windows Forms 883 ■CHAPTER 28 Rendering Graphical Data with GDI+ 929 ■CHAPTER 29 Programming with Windows Forms Controls 983 PART ■■■ Desktop Applications with WPF ■CHAPTER 30 Introducing Windows Presentation Foundation and XAML 1047 ■CHAPTER 31 Programming with WPF Controls 1103 ■CHAPTER 32 WPF 2D Graphical Rendering, Resources, and Themes 1167 PART ■■■ Building Web Applications with ASP.NET ■CHAPTER 33 Building ASP.NET Web Pages 1215 ■CHAPTER 34 ASP.NET Web Controls, Themes, and Master Pages 1261 ■CHAPTER 35 ASP.NET State Management Techniques 1297 INDEX 1331 v 8229FM.qxd 3/5/08 4:23 PM Page vi Contents About the Author xix About the Technical Reviewer xix Acknowledgments xx Introduction and Welcome xxi PART ■■■ ■CHAPTER Introducing Visual Basic 2008 and the NET Platform The Philosophy of NET Understanding the Previous State of Affairs The NET Solution Introducing the Building Blocks of the NET Platform (the CLR, CTS, and CLS) What Visual Basic 2008 Brings to the Table Additional NET-Aware Programming Languages An Overview of NET Assemblies 10 Understanding the Common Type System 16 Understanding the Common Language Specification 19 Understanding the Common Language Runtime 21 The Assembly/Namespace/Type Distinction 22 Using ildasm.exe 27 Using Lutz Roeder’s Reflector 30 Deploying the NET Runtime 30 The Platform-Independent Nature of NET 31 Summary 32 ■CHAPTER Building Visual Basic 2008 Applications 35 The Role of the NET Framework 3.5 SDK 35 The VB 2008 Command-Line Compiler (vbc.exe) 36 Building VB 2008 Applications Using vbc.exe 37 Working with vbc.exe Response Files 40 Building NET Applications Using SharpDevelop 43 Building NET Applications Using Visual Basic 2008 Express 46 vi 8229FM.qxd 3/5/08 4:23 PM Page vii ■CONTENTS Building NET Applications Using Visual Studio 2008 47 The Role of the Visual Basic 6.0 Compatibility Assembly 59 A Partial Catalog of Additional NET Development Tools 61 Summary 61 PART ■■■ ■CHAPTER Core VB Programming Constructs VB 2008 Programming Constructs, Part I 65 The Role of the Module Type 65 The Role of the Main Method 69 An Interesting Aside: Some Additional Members of the System.Environment Class 72 The System.Console Class 73 System Data Types and VB Shorthand Notation 77 Understanding the System.String Type 83 Narrowing (Explicit) and Widening (Implicit) Data Type Conversions 89 Building Visual Basic 2008 Code Statements 94 VB 2008 Flow-Control Constructs 96 VB 2008 Iteration Constructs 99 Summary 102 ■CHAPTER VB 2008 Programming Constructs, Part II 103 Defining Subroutines and Functions 103 Understanding Member Overloading 111 Array Manipulation in VB 2008 113 Understanding VB 2008 Enumerations 120 Introducing the VB 2008 Structure Type 126 Summary 128 ■CHAPTER Designing Encapsulated Class Types 129 Introducing the VB 2008 Class Type 129 Understanding Class Constructors 133 The Role of the Me Keyword 137 Understanding the Shared Keyword 142 Defining the Pillars of OOP 148 Visual Basic 2008 Access Modifiers 151 The First Pillar: VB 2008’s Encapsulation Services 154 Understanding Constant Data 161 Understanding Read-Only Fields 163 Understanding Partial Type Definitions 164 vii 8229FM.qxd viii 3/5/08 4:23 PM Page viii ■CONTENTS Documenting VB 2008 Source Code via XML 165 Visualizing the Fruits of Our Labor 170 Summary 171 ■CHAPTER Understanding Inheritance and Polymorphism 173 The Basic Mechanics of Inheritance 173 Revising Visual Studio 2008 Class Diagrams 177 The Second Pillar: The Details of Inheritance 178 Programming for Containment/Delegation 184 The Third Pillar: VB 2008’s Polymorphic Support 187 Understanding Base Class/Derived Class Casting Rules 198 The Master Parent Class: System.Object 200 Summary 206 ■CHAPTER Understanding Structured Exception Handling 207 Ode to Errors, Bugs, and Exceptions 207 The Role of NET Exception Handling 208 The Simplest Possible Example 210 Configuring the State of an Exception 214 System-Level Exceptions (System.SystemException) 218 Application-Level Exceptions (System.ApplicationException) 219 Processing Multiple Exceptions 222 The Finally Block 226 Who Is Throwing What? 227 The Result of Unhandled Exceptions 228 Debugging Unhandled Exceptions Using Visual Studio 2008 228 Blending VB6 Error Processing and Structured Exception Handling 230 Summary 230 ■CHAPTER Understanding Object Lifetime 233 Classes, Objects, and References 233 The Basics of Object Lifetime 234 The Role of Application Roots 237 Understanding Object Generations 239 The System.GC Type 240 Building Finalizable Objects 243 Building Disposable Objects 246 Building Finalizable and Disposable Types 248 Summary 251 8229Index.qxd 3/7/08 2:05 PM Page 1363 ■INDEX RepeatButton type, 1119–1120 Request object, 1228, 1247 Request property, 1247, 1305 request states, 848 Request.Form collection, 1228 Request.QueryString() method, 1228 request/response cycle, HTTP, 1216 RequestType member, HttpRequest Type, 1248 RequiredFieldValidator control, ASP.NET, 1285–1286 resgen.exe utility, 973, 975–976 ResizeMode attribute, 1162 Resource Build Action, 1196–1197 resource dictionary, 1199 /resource flag, 973 resource writers in NET, 976 ResourceManager method, System.Resources namespace, 973 ResourceManager type, 979–980 ResourceReader method, System.Resources namespace, 973 ResourceResolve event, System.AppDomain, 528 *.resources file, 976 resources in NET, 973–976 resources using Visual Studio 2008, 977–979 ResourceWriter method, System.Resources namespace, 973 ResourceWriter type, 976 response files, VB 2008, 40 Response objects, 1228 Response property, 1247, 1250, 1305 Response.Cookies property, 1319 Result property, 854 Resume() method, 549 *.resx file, 902, 973–976, 979, 1020 ResXForm.resx file, 974 ResXResourceReader method, System.Resources namespace, 973 ResXResourceWriter class, 974, 976 ResXResourceWriter type, 976 ResXResourceWriter.AddResource() method, 974 retained mode graphics, 1167 Return keyword, 104 return value, interface used as, 266 code comment, XML Elements, 166 ReturnType property, 493 Reverse() method, 118, 430 ReverseDigits() method, 392–393 Reverse() method, 430 reversing animation, 1191 rich controls, 1267 RichTextBox control, 1103 RichTextBox property, 1131 Right property, 892 Right value, 1040 Root property, DirectoryInfo class, 610 RotateTransform object, 1186, 1195 RotateTransform type, 1185–1186 roundButtonTemplate template, 1207 RountedEventArgs type, 1114 routed bubbling events, 1113–1115 routed events, 1112–1116 bubbling, 1113–1114 tunneling, 1115–1116 routed tunneling events, 1115–1116 RoutedEventHandler delegate, 1063, 1112 RoutedUICommand type, 1147 row numbers, 729 element, 1138 RowError property, 712 RowPostPaint event, 729 rows programmatically deleting, 723–724 selecting based on filter criteria, 724 updating, 726–727 RowState property, 712–715 *.rsp files, 40, 41 Run() method, 887, 1054 runat="server" attribute, 1237, 1290 runtime, 91, 163 Runtime Callable Wrapper See RCW (Runtime Callable Wrapper) runtime engine, 845 element, 462 runtimes, MFC, VB 6, Java and NET, 21 RunWorkerAsync() method, 567 RunWorkerCompleted event, 567 RunWorkerCompletedEventArgs Result property, 568 S Sandcastle tool, 170 satellite assemblies, 441 Save() method, Image type, 963 SaveAs() method, 1248 SavingsAccount class, 145, 147 SByte keyword, 77 ScaleTransform type, 1185 Scheduling services, WF, 846 script code, 1300 blocks, 1244, 1254, 1261, 1303 scripting languages, 1225 ScrollableControl class, 896, 1011 ScrollBar control, 1103, 1151 ScrollBar type, 1056, 1153 element, 1151 ScrollBars property, 989, 990 scrolling, enabling for panel types, 1141 type, 1141 sealed classes, 183–184, 190 sealing, 176 code comment, XML Elements, 166 code comment, XML Elements, 166 Seek() method, 621, 627 Select() method, 724, 740 select operator, 425, 427 Select statement, 98, 429 Select/Case statement, 99 SelectCommand member, 730 SelectCommand property, 731 SelectedIndex object, 1127 SelectedIndex property, 1014, 1126 SelectedItem property, 1014, 1126, 1163 SelectedValue property, 1126 SelectionChanged event, 1157, 1205 SelectionChanged handler, 1160 SelectionEnd property, 1005 SelectionStart property, 1005 self-describing assemblies, 438 Semaphore type, System.Threading Namespace, 548 SendAPersonByValue() method, 371 separation of concerns principle, 886–887 element, 1143 SequenceActivity, WF, 847 Sequence.Where() method, 422 1363 8229Index.qxd 1364 3/7/08 2:05 PM Page 1364 ■INDEX Sequential Workflow console application, 844, 852 Sequential Workflow Library project, 873 SequentialWorkflowActivity type, 852 attribute, 501–502, 1324, 1329 serialization BinaryFormatter object graph contents, 646 collections, 645 configuring objects for, 636 customizing, 645–646 customizing using attributes, 649–650 customizing using ISerializable, 647–648 definition, 633 GetObjectData() method, 647–648 IFormatter interface, 637–638 IRemotingFormatting interface, 637–638 object graph, 634 overview, 633 persisting collections of objects, 644–645 persisting user preferences example, 634 public and private fields, public properties, 636 Serializable attribute, 636 type fidelity, 638 SerializationFormat.Binary file, 719 SerializationInfo class, 646 SerializationInfo parameter, 650 Serialize() method, BinaryFormatter class, 501 serializeAs attribute, 1326, 1330 Serialized attribute, 502 Server, ASP.NET HttpApplication members, 1305 server controls in ASP.NET, 1261–1263 /server option, 770 Server property, 1247, 1256, 1304, 1305 server-side script, 1227 Server.Transfer() method, 1252 ServerVariables member, HttpRequest Type, 1248 service behavior, 822 service contracts, 808 service types, 808, 815–816 element, 817, 822 Service1.vb file, 830 attribute, 808, 813, 814 ServiceContractAttribute type, 814 serviced component, 797 ServiceHost type, 807, 817, 819–820 serviceHostingEnvironment subelement, 821 service-oriented architecture (SOA), 802–803 ServiceReference namespace, 825 services subelement, 821 container element, 817 Service.svc file, 839 session cookies, 1319 session data, ASP.NET, 1315, 1317 Session property, 1247, 1299, 1305 session variable, 1299 Session_End() event handler, 1304, 1315 Session_Start() event handler, 1304, 1315 SessionID property, 1317 SessionMode property, 814 sessionState element, web.config, ASP.NET, 1257, 1322 element, 1318 overview, 1321–1322 storing session data in ASP.NET session state server, 1322 storing session data in dedicated database, 1323 element, web.config File, 1257 Session.Timeout property, 1318 Set scope, 157 set_SocialSecurityNumber() method, 159 SetDriverName() method, 137 SetF1CommandBinding() method, 1149 SetLength() method, Stream class, System.IO, 621 element, 1199, 1202, 1203–1204, 1210 Setter/Getter tokens, 486 Settings.Settings File, 746–747 SetValue() method, 1111 shadowing, 196 Shadows keyword, 197 shallow copy, 275–278 Shape base class, 196 Ellipse type, 1175–1176 Line type, 1175–1176 Path type, 1176–1177 Polygon type, 1176–1177 Polyline type, 1176–1177 Rectangle type, 1175–1176 Shape class, 149 Shape parent class, 260 Shape type, 151, 193, 1169, 1174 Shape-compatible types, 262 Shape-derived types, 1169–1170 Shape base class, 1175–1177 Ellipse type, 1175–1176 Line type, 1175–1176 Path type, 1176–1177 Polygon type, 1176–1177 Polyline type, 1176–1177 Rectangle type, 1175–1176 shared assembly, 466 shared constructor, 148 Shared field data, 144 Shared keyword, 69 overview, 142 Shared constructors, 147–148 Shared data, 144–147 Shared methods (and fields), 142–144 Shared keywords, 334 shared members, 65, 142 Shared method, 145 Shared properties, 160–161 SharpDevelop, 43–46 Shift property, 892, 896 shopping cart application, ASP.NET, 1315, 1317 ShoppingCart class, 1324 Short keyword, 77 Short variable, 89, 299 Show() method, 893, 1061 ShowDialog() method, 897, 944, 952, 1036 ShowInstructions() method, 693 ShowInstructions method, 853 ShowInTaskbar property, 897, 1035 ShowMessageBox property, 1289 ShowSummary property, 1289 Shutdown() method, 1062 Silverlight, 1052–1053 simple controls, 1267 SimpleArrays() method, 113 SimpleComServer.dll file, 573 SimpleInventory.xml file, 786 SimpleLine object, 1176 SimpleMath class, 332, 356 SimpleMath object, 356 8229Index.qxd 3/7/08 2:05 PM Page 1365 ■INDEX SimpleXamlApp.exe program, 1193 SimpleXamlApp.vbproj file, 1073 SimpleXamlPad.exe, 1095–1099, 1204 single file code model, ASP.NET, 1231 Single keyword, 78 single logical parameter, 108 single-file assemblies, 12 single-file assembly, 441 single-file page model, 1231 SinglePageModel, 1244 sink object, 285, 287, 289 *.sitemap file, 1272 SiteMapNavigation type, 1275 element, 1273 SiteMapPath type, 1275 SiteMapPath widget, 1280 Size class, 933 Size method, Image type, 963 Size namespace, System.Drawing, 931 Size property, ADO.NET DbParameter, 689 Size type, 931 SizeF class, 933 SizeF namespace, System.Drawing, 931 SkewTransform object, 1186 SkewTransform type, 1185 SkinID member, System.Web.UI Control, 1264 SkinID property, 1264, 1292 Sleep() method, Thread type, 548 Slider control, 1103 SmallChange property, TrackBar, 1009 SMEs (subject matter experts), 844 SmoothingMode property, Graphics class, 934 sn.exe, strong name utility, 467–468 *.snk file, 467, 585, 599 SOA (service-oriented architecture), 802–803 *.soap file, 649 SoapFormatter, serialization, 640 SoapFormatter type, 638 SocialSecurityNumber property, 158 sockets, 801 SolidColorBrush object, 1177 SolidColorBrush type, 1155, 1177–1178 element, 1178 Solution Explorer, 49, 852 SomeClass class, 446 Sort() method, 118, 281 Sorted property, DomainUpDown, 1014 SortedDictionary(Of K, V) class, System.Collections Generic, 307 SortedList class, System.Collections, 295 SortedList System.Collections class type, 295 sorting and paging example, ASP.NET, 1280–1281 SoundPlayerAction control, 1104 Source attribute, 1162 Source property, 1183, 1196 specifying DbParameter parameters, ADO.NET, 690 Speed property, 1027 SpeedRatio property, 1188 SpeedUp() method, 130 SpellCheck.IsEnabled property, 1129 SpellingError object, 1130 SpinButtonWithLinearKeyFrames.xaml file, 1195 Splitter class, 884 /sprocs flag, 774 /sprocs option, 771 SQL, programming with LINQ to, 765–770 attribute, 769–770 DataContext type, 766–768 entity classes, 765–766 example, 766–768 attribute, 769–770 SqlCommand object, 686, 733, 751, 775, 1313 SqlCommand type, 734, 765 SqlCommandBuilder property, 734 SqlCommandBuilder type, configuring Data Adapter, 733–734 SqlConnection type, 765 SqlConnectionStringBuilder type, 768 SqlDataAdapter member variable, 733 SqlDataAdapter object, 734, 756 SqlDataAdapter type, 765 SqlDataSource type, 1278 SqlMetal.exe, generating entity classes with, 770 defining relationships, 773 programming against generated types, 774–776 strongly typed DataContext type, 773–774 SqlParameter object, 751 SqlParameter type, 734 SqlProfileProvider, 1325 square brackets, 203, 513 Square type, 376 SquareNumber() method, 332, 333 Stack class, System.Collections, 295 Stack System.Collections class type, 295, 297 stack/heap memory transfer, 301 Stack(Of T) class, System Collections.Generic, 307 StackPanel control, 1104, 1113 StackPanel objects, 1127 StackPanel panels, 1136–1137 element, 1106, 1119, 1125, 1130, 1152, 1160, 1168–1169, 1173 StackTrace property, System Exception, 210, 215–216 Start() method, 349, 521, 549 StartCap property, Pen type, 954 StartFigure() method, 971 starting and stopping processes, example code, 526 StartLineCap controls, 1180 StartPosition property, 897 StartType property, 833 Startup event handler, 1064 StartUp Object/Main() sub distinction, 904–905 StartupEventArgs delegate, 1061 StartupEventArgs parameter, 1064 StartupEventHandler delegate, 1061 StartupLocation.CenterScreen value, 1076 StartupPath property, 887 StartupUri property, 1054, 1072, 1075 state data, multithreaded applications, 546–547 state machine workflows, 848 state management overview, 1261, 1297 state management problems, 1297–1299 state management techniques, 1299 application cache, 1310 application shutdown, 1309–1310 1365 8229Index.qxd 1366 3/7/08 2:05 PM Page 1366 ■INDEX application-level state data, 1306–1308 applications vs sessions, 1305 ASP.NET profile API acessing profile data programmatically, 1326–1328 ASPNETDB database, 1324–1325 defining user profile within web.config, 1325–1326 grouping profile data and persisting custom objects, 1329–1330 overview, 1324 control state, state management, 1302 cookies creation, 1319 cookies overview, 1318 custom view states, state management, 1302 data caching, 1311–1314 Global.asax file, 1303–1304 HttpApplication type overview, 1297 HttpSessionState members, 1317 maintaining session data, 1315, 1317 modifying application data, 1309 overview, 1297 per user data stores, 1315, 1317 persistence of cookies, 1319 problems in state management, 1297–1299 reading cookies, 1321–1322 role of element overview, 1321–1322 storing session data in ASP.NET session state server, 1322 storing session data in dedicated database, 1323 session cookies, 1319 session data, 1315, 1317 state management overview, 1297 state management techniques, 1299 view state, state management, 1300–1301 Web.config, 1322 State property, 679, 820 StateBag type, 1302 stateConnectionString attribute, 1322 stateless wire protocol, 1216, 1297 statement continuation character, 95–96 statements (in general), 94 static classes, 160, 391, 395 static data, methods containing, 110 Static keyword, 110, 142–143, 145–147 static local variables, methods containing, 110 StaticResource markup extension, 1155, 1200, 1203 StatusBar class, 884 StatusBar control, 1104 StatusBar type, 1144 StatusCode property, HttpResponse Type, 1251 StatusDescription property, HttpResponse Type, 1251 StatusStrip type, 913–919 designing, 914–917 designing menu systems, 914 displaying menu selection prompts, 918–919 establishing “Ready” state, 919 overview, 913 Timer type, 917 toggling displays, 917–918 Step keyword, 100 stored procedures using DbCommand, ADO.NET, 690 Storeyboard.TargetName value, 1194 element, 1192, 1195 Storyboard.TargetProperty value, 1194 Stream class, 620–621 Stream class, System.IO, 620, 621 StreamingContext parameter, 650 StreamReader object, 623, 625 StreamWriter object, 623, 625 Stretch property, 1175 StretchBox() function, 1025 strFontFace string variable, 949 String class, 204 string concatenation, 85 String data type, 70, 86, 130, 579, 782 String keyword, 78, 82–83 String member variable, 1115, 1299 String objects, 86, 87 String parameter, 181 String type, 82, 739 element, 1194 StringBuilder class, 88, 924 String.Concat() method, 85 StringDictionary member, System.Collections Specialized Namespace, 298 StringEnumerator member, System.Collections Specialized Namespace, 298 String.Format() method, 76 StringFormat namespace, System.Drawing, 931 StringTarget() method, 325 Stroke property, 1175 StrokeDashArray property, 1175 StrokeEndLineCap property, 1175 StrokeThickness property, 1175 strong names, 438, 451, 467–468, 470, 599–600 strongly typed collection, 302 strongly typed events, defining, 347–348 Structure keyword, 126 structure types, 17, 69, 126–128 structured exception handling advantages, 208 application-level exceptions, 219–221 blending VB 6.0 error processing with, 230 bugs, description, 207 catching exceptions, 213 configuring exception state, 214 custom exceptions, 219–221 entities used in, 209 exceptions, description, 207 finally block, 226–227 generic exceptions, 212–213, 224 inner exceptions, 225–226 keywords used, 209 multiple exceptions, 222–224 overview, 207 possible NET exceptions, 227 rethrowing exceptions, 224–225 simple example, 210–213 System.Exception, 209–213 system-level exceptions, 218 System.Serializable attribute, 221 8229Index.qxd 3/7/08 2:05 PM Page 1367 ■INDEX template, exception, 222 throwing an exception, 212–213 traditional exception handling, 208 try/catch block, 213 typed exceptions, 227–228 unhandled exceptions, 228 user errors, description, 207 Visual Studio 2008 features, 227–229 structures and enumerations, value based types, 366 style sheets, 1289 element, 1199 styles, for WPF controls, 1198–1206 assigning implicitly, 1203 assigning programmatically, 1205–1206 defining with triggers, 1203–1204 inline, 1198–1199 named, 1199–1200 narrowing, 1202 overriding settings, 1201 subclassing existing, 1201 widening, 1202 StyleWithTriggers.xaml file, 1204 Sub keyword, 103, 331 Sub Main() method, 69, 885, 887, 894, 904–905 subclasses, 194, 1201 subject matter experts (SMEs), 844 Submit button, 1226, 1288 SubmitChanges() method, 778 submitting form data, ASP.NET, 1226–1227 subroutines vs functions, 103 and functions, defining ByRef parameter modifier, 105–107 ByVal parameter modifier, 104–105 defining optional arguments, 107–108 method calling conventions, 109 methods containing static data, 110 methods containing static local variables, 110 overview, 103–104 working with ParamArrays, 108–109 subset data type, 390 subset variable, 413 Subtract() method, 334, 399, 597 Suggestions property, 1130 code comment, XML Elements, 166 SuppressContent property, HttpResponse Type, 1251 Suspend() method, Thread type, 549 SuspendActivity, WF, 847 *.svc file, 806, 839, 840 SvcConfigEditor.exe file, 811, 828–829 svcutil.exe tool, 822, 824–825 Swap() method, 313, 316, 322 swellValue data member, 949 Synchronization attribute, 533 synchronization attribute, multithreaded applications, 562 synchronizing threads, 543–544 synchronous delegate call, 328 SyncLock keyword, 1314 SyncLock statement, 1309 Sysem.Windows.Shapes.Shape namespace, 1169 system data types data type class hierarchy, 80–81 default values of data types, 79–80 experimenting with numerical data types, 81–82 members of System.Boolean, 82 members of System.Char, 82–83 “New-ing” intrinsic data types, 81 overview, 77–78 parsing values from string data, 83 variable declaration and initialization, 78–79 System namespace, 24, 77, 420, 1236 System.Activator class, late binding, 498–499 System.AppDomain class, 527, 528, 529, 530 System.ApplicationException, structured exception handling, 219–221 System.Array class, 118–120, 281, 283, 415 System.Array object, 433 System.Array type, 413 System.Attribute base class, 501 System.Boolean, 82, 310, 384, 966 System.Char, 82–83 SystemCLSCompliant() method, 21 System.Collections, 419 System.Collections class types, 294 ArrayList, 294–295 Hashtable, 294 Queue, 295–297 SortedList, 295 Stack, 295, 297 System.Collections interfaces, 292–294 System.Collections namespace, 24, 102, 273, 292, 300, 302 System.Collections.ArrayList, 1330 System.Collections.ArrayList member variable, 303 System.Collections.DictionaryEntry class type, 294 System.Collections.Generic namespace, 24, 291, 317, 323, 417 System.Collections.Generic EqualityComparer type, 405 System.Collections.Generic List, 306–309 System.Collections.Generic List(Of T) class, 305, 306 System.Collections.ObjectModel namespace, 1158 System.Collections.Queue type, 296 System.Collections.Specialized, 298 System.Collections.Stack type, 297 SystemColors namespace, System.Drawing, 930 System.ComponentModel, 891, 898, 1030, 1031 System.Configuration namespace, 480 System.Configuration.dll assembly, 735 System.Configuration.dll file, 738 System.Console class basic input and output with, 74 formatting output, 74–75 NET string formatting flags, 75–76 overview, 73–74 System.Console type, 38, 58 1367 8229Index.qxd 1368 3/7/08 2:05 PM Page 1368 ■INDEX System.ContextBoundObject, 532–533 System.Convert, 94 System.Core namespace, 768 System.Core.dll assembly, 411, 420, 759, 761 System.Data, ADO.NET, 659 System.Data namespace, 24, 654, 705, 761 System.Data.Common namespace, 732 System.Data.Common.DataTableMapping type, 732 System.Data.DataSetExtensions dll assembly, 759, 761 System.Data.DLinq.dll assembly, 411 System.Data.Extensions.dll assembly, 411 System.Data.Linq namespace, 767–768 System.Data.Linq.dll assembly, 411, 760, 766, 771, 776 System.Data.Linq.Mapping namespace, 765, 767 System.Data.Odbc namespace, 24 System.Data.OleDb namespace, 24 System.Data.OracleClient namespace, 24 System.Data.SqlClient namespace, 24, 685, 1234 System.Delegate base class, 331 System.Delegate.Combine() method, 337 System.Diagnostics namespace, 520 element, 464 System.Diagnostics.Process, 520–521 SystemDirectory property, System.Environment, 73 System.dll and System.Windows Forms.dll assemblies, 886 System.Drawing, GDI+ namespaces, 929 System.Drawing namespace, 24, 894, 934, 946, 957 core types, 930–931 GDI+, 930 PointF type, 931 RectangleF type, 932 Rectangle(F) type, 933 Region class, 933 utility types, 931 System.Drawing.Brush, 957 System.Drawing.Brush-derived types, 957 System.Drawing.Color object, 1009 System.Drawing.Color.FromName() method, 908 System.Drawing.dll, 1047 System.Drawing.Drawing2D, 953 System.Drawing.Drawing2D, GDI+, 929, 953 System.Drawing.Drawing2D namespace, 929, 953, 959, 971 System.Drawing.Font, GDI+, 945–946 System.Drawing.Font type, 945 System.Drawing.Graphics class, 933, 934, 935 System.Drawing.Graphics object, 931 System.Drawing.Image, 963, 965 System.Drawing.Imaging namespace, GDI+, 930 System.Drawing.Point type, 931 System.Drawing.Printing namespace, GDI+, 930 System.Drawing.Text namespace, 930, 950 System.EnterpriseServices namespace, 797 System.Enum class, 122–124, 126 System.Environment class, 72–73 System.Environment type, 70–71 System.EventArgs base class, 345, 349 System.EventArgs parameter, 348 System.EventHander delegate, 349 System.EventHandler, 348, 857, 889–890, 1237 System.Exception, 1304 Data property, 210, 216–217 HelpLink property, 210, 216 InnerException property, 210 Message property, 210, 220–221 StackTrace property, 210, 215–216 TargetSite property, 210, 214–215 System.GC, 240–242 System.Guid, 277–279, 709 System.IComparable interface, 280 SystemIcons namespace, System.Drawing, 930 System.IdentityModel.dll assembly, 804 System.IDisposable interface, 233 System.Int32 type, 384, 393, 397 System.IO namespace, 24, 444 System.IO.Compression namespace, 24, 108, 992 System.IO.Pipes namespace, 801 System.IO.Ports namespace, 24 System.Linq namespace, 25, 412 System.Linq.Enumerable type, 415, 420–421, 424 System.MarshalByRefObject class, 891 System.Messaging namespace, 797 System.MulticastDelegate class, 328, 331 System.MulticastDelegate namespace, 592 System.MulticastDelegate/ System Delegate members, 331 System.Net.PeerToPeer namespace, 801 System.Net.Sockets namespace, 801 System.Nullable(Of T) generic type, 291 System.Object overriding System.Object Equals(), 203–204 overriding System.Object GetHashCode(), 204 overriding System.Object ToString(), 203 overview, 200–203 shared members of, 205–206 stimulating generic delegates using, 325–326 testing modified person class, 204–205 System.Object argument, 345, 349, 857 System.Object class, 81, 489, 891, 904, 907–908, 910, 912, 914, 917–919, 921–926, 1121 System.Object parameter, 889 System.Object variable, 299 System.Object vs System.ValueType, 366 System.Object.Equals() method, 203–204, 363–364 System.Object.Finalize() method, 233 System.Object.GetHashCode() method, 204 8229Index.qxd 3/7/08 2:05 PM Page 1369 ■INDEX System.Object.GetType() method, 115 System.Object.ToString() method, 203 System.OverflowException, 90 SystemPens namespace, 930 System.Query.dll assembly, 411 System.Query.Func delegate types, 422 System.Random member variable, 143 System.Reflection namespace, 24, 483, 488, 490, 494, 514, 586 System.Reflection.Assembly class type, 461 System.Reflection.Emit namespace, 24, 391 System.Reflection.MethodInfo types, 490 System.Resources namespace, 973 System.Runtime.InteropServices namespace, 24, 580, 594–595 System.Runtime.Remoting namespaces, 797 System.Runtime.Serialization namespace, 804, 808 System.Runtime.Serialization.dll assembly, 804, 808 System.Security namespace, 25 System.Serializable attribute, structured exception handling, 221 System.ServiceModel namespace, 25, 801, 804, 808, 813, 816 element, 817, 820–821, 839 System.ServiceModel.ClientBase class, 824 System.ServiceModel Configuration namespace, 804 System.ServiceModel.Description namespace, 804 System.ServiceModel.dll assembly, 804, 813, 816, 830 System.ServiceModel.MsmqInte gration namespace, 804 System.ServiceModel.Security namespace, 804 System.String attribute, 1325 System.String class, 88 System.String data type, 579 System.String member variable, 898 System.String type, 1125 basic String manipulation, 84 and equality, 86 overview, 83–84 string concatenation (and “Newline” constant), 85–86 strings are immutable, 87–88 System.Text.StringBuilder type, 88–89 System.Text namespace, 88 System.Threading namespace, 25, 328, 351, 563, 1309, 1314 Interlocked type, 548 Monitor type, 548 Mutex type, 548 ParameterizedThreadStart delegate, 548, 551, 554 Semaphore type, 548 Thread type, 548 ThreadPool type, 548, 564–565 ThreadPriority enum, 548 ThreadStart delegate, 548, 552–553 ThreadState enum, 548 Timer type, 548 TimerCallback delegate, 548, 562, 564 System.Type class, 489–490 System.Type parameter, 490 System.Uri objects, 818 System.ValueType, 366 System.ValueType class, 81, 259, 366 System.Web namespace, 25, 1231 element, 1291, 1325 System.Web.Caching namespace, 1231 System.Web.Caching.Cache object, 1310 System.Web.Hosting namespace, 1231 System.Web.HttpApplication class, 1304, 1305 System.Web.HttpCookie type, 1319 System.Web.Management namespace, 1231 System.Web.Profile namespace, 1231 System.Web.Security namespace, 1231 System.Web.Services namespace, 798 System.Web.SessionState namespace, 1231 System.Web.UI namespace, 1231 System.Web.UI.Control class, 1301–1302 System.Web.UI.Control in ASP.NET, 1263, 1264 System.Web.UI.HtmlControls namespace, 1231 System.Web.UI.HtmlControls widget, 1268 System.Web.UI.Page class, 1247, 1300, 1305 System.Web.UI.Page-derived type, 1252, 1315 System.Web.UI.Page.Request property, 1247 System.Web.UI.StateBag type, 1302 System.Web.UI.TemplateControl class, 1246 System.Web.UI.WebControls namespace, 1231, 1261–1262 System.Web.UI.WebControls Panel class, 1264 System.Web.UI.x namespace, ASP.NET 2.0, 1231 System.Window.Application class type, 1054 System.Windows namespace, 25, 1053, 1172 System.Windows.ContentControl class, 1057 System.Windows.Controls namespace, 25, 1053, 1062, 1107, 1132 System.Windows.Controls Button type, 1208 System.Windows.Controls ContentControl base class, 1056–1057 System.Windows.Controls Control base class, 1057 System.Windows.Controls Primitives namespace, 1118 System.Windows.Data namespace, 1153 System.Windows.DependencyO bject base class, 1059, 1111 System.Windows.DependencyProperty class type, 1110 System.Windows.Documents namespace, 1131 1369 8229Index.qxd 1370 3/7/08 2:05 PM Page 1370 ■INDEX System.Windows.Forms namespace, 24, 39, 256, 552, 883–885, 924, 944, 983, 987, 995, 1035, 1262 System.Windows.Forms ContainerControl class, 891 System.Windows.Forms.Control class, 891, 983 System.Windows.Forms.dll assembly, 450, 885, 1047 System.Windows.Forms.Form class, 885, 891, 1062 System.Windows.Forms ScrollableControl class, 891 System.Windows.Forms.TreeNode object, 1018 System.Windows.Forms.WebBrowser control, 1021 System.Windows.Input.KeyEvent Handler delegate, 1069 System.Windows.Markup namespace, WPF, 1054 System.Windows.Media namespace, 1054, 1172 System.Windows.Media Animation namespace, 1167, 1187, 1193 System.Windows.Media.Brush namespace, 1177 System.Windows.Media.Color type, 1177 System.Windows.Media.Drawing abstract base class, 1170 System.Windows.Media.Drawing class, 1181 System.Windows.Media.Drawing namespace, 1168 System.Windows.Media Geometry base class, 1181 System.Windows.Media.Shapes types, 1182 System.Windows.Media.Timeline base class, 1188 System.Windows.Media.Visual base class, 1059 System.Windows.Media.Visual class type, 1170 System.Windows.Media.Visual namespace, 1168 System.Windows.Navigation namespace, WPF, 1054 System.Windows.RoutedEventArgs parameter, 1112 System.Windows.Shapes namespace, 1054, 1168–1169, 1175 System.Windows.Threading DispatcherObject base class, 1059 System.Windows.UIElement base class, 1058 System.Windows.Window type, 1055 System.Workflow.Activities namespace, 25, 847, 850 System.Workflow.Activities.dll core assembly, 850 System.Workflow.ComponentModel.dll core assembly, 850 System.Workflow.Runtime namespace, 25, 850 System.Workflow.Runtime.dll core assembly, 850 System.Workflow.Runtime Hosting core namespace, 850 System.Xml namespace, 25, 410, 1164 System.Xml.dll assembly, 779 System.Xml.Linq namespace, 25, 780, 789 System.Xml.Linq.dl assembly, 411 System.Xml.Serialization namespace, 643 System.Xml.XLinq namespace, 780–783 System.Xml.XLinq.dll assembly, 411 T tab order for controls, 1003 TabControl control, 1008–1009, 1103 TabIndex property, 988, 1267 TabIndex value, 1003, 1162 TabIndexTSRTabStop property, 892 attribute, 767, 769–770 Table property, 710, 712 table relationships building, 738–739 navigating between related tables, 739–742 TableAdapter component, 744 TableAdapterManager type, 755 TableAttribute type, 767 TableLayoutPanel, controls, 1041, 1043 TableLayoutPanel type, 1041 TableMappings property, 732 TableName member, 715 TableName property, 733 Table(Of T) type, 778 Tables property, 706–707 TabOrder property, 1003 TabStop property, 1003 Tag property, 1128 Target property, 331, 334, 356 TargetProperty property, 1192 *.targets files, 1072, 1074 TargetSite property, System Exception, 210, 214–215 TargetType property, 1202–1203 TCP-based bindings, 810–811 template, exception code expansion, 222 Template property, 1207, 1210 templates, altering WPF control UI with, 1207–1211 adding triggers to, 1208–1209 custom, 1207–1208 incorporating into styles, 1210–1211 templating services, 1057 temporary cookie, 1319 temporary object variable, 57 TerminateActivity, WF, 847 TestApp class, 39 TestApp.exe, 37, 42 TestApp.rsp response file, 41 TestApp.vb file, 38 text areas, 1129–1131 PasswordBox type, 1130–1131 TextBox type, 1129–1130 Text property, 892, 903, 908, 917–918, 925, 968, 988, 1013, 1155, 1249, 1252, 1266, 1269 TextAlign property, 989, 993, 1013 TextBlock type, 1144 Textbox, 989 TextBox control, 989–991, 1016, 1103, 1263 TextBox type, 739, 986, 1129–1130, 1151, 1153, 1203 TextBox widget, 1014, 1264, 1286 TextBoxStyle style, 1203 TextChanged event, 1012, 1263 TextPad development editor, 43 TextReader, System.IO, 625 TextRenderingHint property, Graphics class, 934 textual identifier, 285 TextureBrush, System.Drawing Brush, 960 TextWriter class, 623 TextWriter, System.IO, 623 Theme attribute, 1292 8229Index.qxd 3/7/08 2:05 PM Page 1371 ■INDEX Theme, Page Type properties, ASP.NET, 1247 Theme property, Page Type, 1247 themes, 1230, 1289 Thickness property, 1180 this keyword, 137–138, 391–392 ThousandsSeparator property, NumericUpDown, 1014 ThousandsSeparatorHexadecimal property, NumericUpDown, 1014 Thread class, 537 Thread Local Storage (TLS), 519 Thread object, 328 Thread type, 548–551 ThreadExit event, 888 ThreadPool type, System.Threading namespace, 548, 564–565 threads, 236 example code, 522 hyperthreading, 519 multithreading, 519 overview, 518 Thread Local Storage (TLS), 519 time slice, 519 threads suspended during garbage collection, 236 Threads, System.Diagnostics Process, 521 ThreadStart delegate, System.Threading namespace, 548, 552–553 ThreadState enum, System.Threading namespace, 548 ThreadState method, Thread type, 549 ThreeDCircle type, 197 ThreeState property, 996 ThrowActivity, WF, 847 Tick event, 917, 1027 Tick handler, 951 TickFrequency property, TrackBar control, 1009 TickStyle property, TrackBar control, 1009 time slice, defined, 519 Timeline base class, 1188 timeout attribute, element, 1318 Timeout property, 1318 Timer member variable, 917 Timer object, 948 Timer type, 917, 1024, 1027 Timer type, System.Threading namespace, 548 TimerCallback delegate, System.Threading namespace, 548, 562, 564 TimeSpan object, 1190–1191 Title member, System.Console, 74 Title property, 1114 tags, 1221 *.tlb file, 581, 601 /tlb flag, 600 tlbimp.exe utility, 585, 586, 590, 592 TLS (Thread Local Storage), 519 To keyword, 115 To property, 1188, 1190 ToArray() method, 296 ToArray() method, 417, 432, 433 ToDictionary() method, 417 ToggleButton control, 1103 ToggleButton type, 1118 toggling displays, 917–918 tokens in MaskedTextBox control, 991 ToList() method, 417 ToLower() property, 84 ToolBar class, 884 ToolBar control, 1104 ToolBar type, 1143–1144 element, 1144 attribute, 1033 ToolsSpellingHints_Click() method, 1143 ToolStripButton types, 920 ToolStripComboBox element, 905, 909, 920 ToolStripContainer control, 922–923 ToolStripDropDownButton event, 918 ToolStripDropDownButton type, 913, 916 toolStripDropDownButtonDateTime member, 917 ToolStripMenuItem element, 905, 907, 909–912, 918 ToolStripMenuItem Type, 911–912 ToolStripProgressBar type, 913 ToolStrips type, 919–923 ToolStripSeparator element, 906, 909, 920 ToolStripSplitButton type, 913 ToolStripStatusLabel type, 913, 916 toolStripStatusLabelClock member variable, 917 toolStripStatusLabelClock pane, 917 toolStripStatusLabelMenuState member variable, 918 ToolStripTextBox element, 906, 908–909, 920 toolStripTextBoxColor control, 908 ToolTip control, 1006, 1104 ToolTip property, WebControl base class, 1267 tooManyCharactersErrorProvide r, 1016 Top property, 892, 1134 ToString() method, 124, 201–202, 203–204, 278, 404–406, 426, 429, 767, 1125, 1127, 1159 TotalProcessorTime, ProcessThread type, 524 ToUpper() method, 84, 87 Trace, ASP.NET directive attribute, 1236 Trace attribute, 1241 Trace attribute, directive, 1236 trace element, web.config, ASP.NET, 1257 Trace property, 1241, 1247 element, web.config File, 1257 tracing support, 1241 TrackBar control, 1009–1010 Tracking services, WF, 846 Transaction object, ADO.NET data providers, 655 Transaction services, WF, 846 Transform abstract base class, 1184 Transform() method, 933 Transform property, 934, 1181 transformations, 1185–1187 Transform-derived types, 1185–1186 type, 1185, 1186 Translate() member, 933 TranslateTransform() method, 939, 942 TreeView class, 884 TreeView control, 1016–1019, 1103, 1274 TreeView type, 1274 TreeViewEventArgs object, 1019 element, 1192 Trim() property, 84 1371 8229Index.qxd 1372 3/7/08 2:05 PM Page 1372 ■INDEX triple tick (''') code comment notations, 165 Try/Catch logic, 263, 908 Try/Final block, 227 TSRScrollBarTSRStatusStripTSRToolStrip class, 884 tunneling event, 1113 TurboBoost() method, 448 TwoWay mode, 1153 type aliases, 446–448 type attribute, 1223, 1326, 1330 Type class, 489, 831 type definition, 484 type, determining, 199, 200 type indexers, 304 type library, 581, 585, 600 type parameters, 291, 308, 320–322 type reference, 484 type reflection AssemblyRef, 486 description, 487 example metadata, 485–486 external private assemblies, 494–495 fields and properties, 490 implemented interfaces, 491 metadata and type reflection, 483–484 method parameters and return values, 493–494 methods, 490 other metadata, 491 overview, 483 shared assemblies, 496–498 TypeDef, 484–485 TypeRef, 484–485 User Strings, 487 typed exceptions, structured exception handling, 227–228 TypeDef, 484–485 TypedTableBaseExtensions type, 761 Type.GetCustomAttributes() method, 509 Type.GetFields() method, 488 Type.GetMethod() method, 499 Type.GetMethods() method, 488, 490 typeof operator, 490 TypeOf/Is construct, 986 TypeOf/Is syntax, 247 TypeRef, 484–485 TypeRef token, 484 TypeResolve event, System.AppDomain, 528 types, five categories of, 16 U /u option, gacutil.exe, 470 UBound() helper function, 115 ufo.netmodule binary, 458 ufo.vb file, 458 UI elements, 1049 UIElement base class, 1058, 1182 UIElement element, 1169 UInteger keyword, 77 ULong keyword, 78 unbound generic type, 320 unbound type parameters, 320 unboxing custom value types, 301 Unchanged value, 713 Unchecked events, 1118 undefined value, 311 underbar ( _ ) token, 95 unhandled exceptions, structured exception handling, 228 UnhandledException event, System.AppDomain, 528 UninstallSqlState.sql file, 1323 Union() member, 933 unique name/value type pairs, 407 Unique property, 710 unit of measure, GDI+, 940 Unload, ASP.NET Page events, 1253 Unload event, Page type, 1253 Unlock() method, 1307, 1309, 1314 unmanaged code, 571 unmanaged resources, 233, 240, 243–250 Until clause, 101 Update() method, 730 UpdateCarInventory() method, 1312 UpdateCarPetName() method, 695 UpdateCheck property, 770 UpdateColor() function, 1011 UpdateCommand property, 733 UpdateInventory() method, 735–736 updating applications using shared assemblies, 473 database tables, 739 existing items in relational databases, 778 records, ADO.NET, 687 rows, 726–727 web.config file, 839 UpDown control, 1013–1014 UpDownAlign property, UpDownBase, 1013 UpDownBase, 1013 Uri class, 831 Url property, 1021 UseMnemonic property, 988 user errors, description, 207 /user option, 770 User Strings token, 487 UserControl Test Container, 1028 UserControls, 1270 UserHostAddress member, HttpRequest Type, 1248 UserHostName member, HttpRequest Type, 1248 UserMessageDialog instance, 1037 UserName property, System.Environment, 73 userName string member variable, 854 UserShoppingCart class, 1316 UserTheme session variable, 1295 UseThisObject() method, 300 UShort keyword, 77 using keyword, 247–248 Using keyword, 248, 455 V Validated property, Control, 1015 ValidateInput() method, 1248 Validating event handler, 1015 Validating property, Control, 1015 validation controls, ASP.NET, 1285–1288 validation schemes, 1220 ValidationExpression property, 1287 ValidationSummary control, ASP.NET, 1285, 1288 ValidationSummary widget, 1288 value and reference types, conversion, 298 Value members, 311 Value property, 311, 689, 1009, 1014, 1269 value types and reference types, 365–373 code comment, XML Elements, 166 value-based semantics, 203 value-based types, 365 ValueChanged event, 1151 VB 2008 class type allocating objects with New keyword, 132 8229Index.qxd 3/7/08 2:05 PM Page 1373 ■INDEX creating objects with New keyword, 132–133 overview, 129–131 VB 2008 Client, 573–575, 590–591 VB COM server, 582–583 *.vb files, 39, 445–446, 853, 886, 976 VB6 COM server, 587–589 VB6 language deficiencies, Vb6ComCarServer.dll assembly, 590 VbAutoLotWCFService type, 838 vbc.exe command-line compiler, 35, 70 vbc.exe compiler command-line flags, 37–38 compile parameters, 37–38 default response file (vbc.rsp), 41–43 INSERT-FORARDSLASHHEREnostdlib commandline flag, 38–39 mscorlib.dll, 38–39 multiple external assemblies, 40 multiple source files, 39–40 /noconfig command-line flag, 41–43 /reference command-line flag, 39 referencing external assemblies, using keyword, 38–39 response files, 40–41 wildcard character, 40 VbDotNetCalc.tlb file, 601 VbNetSnapIn.dll assembly, 512, 515 *.vbproj files, 1072, 1079, 1242 VBScript support, 1225 vector graphics, 1050 attribute, 507 VehicleDescriptionAttribute class, 509–510 ver directive, 451 ver token, 469 version number of assemblies, 438 Vertical property, 1135 VerticalAlignment property, 1207 VerticalResolution method, Image type, 963 VeryComplexQueryExpression type, 425 VideoDrawing type, 1181 View In Browser menu option, 1235 view state, 1266, 1300–1301 Viewbox control, 1104 /views option, 771 VIEWSTATE field, 1300–1301 VIEWSTATE form field, 1229 ViewState property, 1302, 1307 virtual directory, 1217 virtual keyword, description, 188 virtual members, 150, 188, 190 virtual methods, 188, 192 Visible member, System.Web.UI Control, 1264 Visible property, 892, 1012, 1264 VisibleClipBounds property, Graphics class, 934 Visual Basic 6.0 test client, 602–603 Visual Basic NET integration with C#, 456–457, 459–460 Visual Basic snap-in example, 513 Visual C# Express, 46 Visual Studio 2008 additions available, 48 automated coding support, 52–53 building entity classes with, 776–779, 783 deleting existing items, 778–779 inserting new items, 778 updating existing items, 778 building WPF applications using, 1091–1095 Class View, 51 command prompt, 36 data access tools of, 742–753 App.config File, 746–747 DataGridView designer, 742–746 generated data adapters, 751 generated DataRow class, 749–750 generated DataSet type, 747–749 generated DataTable class, 749–750 Settings.Settings File, 746–747 using generated types in code, 753 FxCop, 61 generating proxy code with, 825–826 generating resources, 977–979 inserting COM class with, 598–599 integrated Help system, 58–59 Lutz Roeder’s Reflector for NET, 61 NAnt, 61 NDoc, 61 New Project dialog box, 48 Nunit, 61 Object Test Bench, 57 overview, 47 project configuration (Project Properties), 50 project templates, 805–806 Solution Explorer, 49 Visual Class Designer, 53–56 Windows Forms projects, 900–905 dissecting, 902–903 implementing events at design time, 904 overview, 900–902 StartUp Object/Main() sub distinction, 904–905 WPF controls, 1104 VisualBrush type, 1177 VisualChildrenCount read-only property, 1172 Visual-derived types, 1171–1172, 1174 /vpath: option, 1219 W WaitReason, ProcessThread type, 524 WCF (Windows Communication Foundation) Service addresses, 812 bindings, 809–811 HTTP-based, 809–810 MSMQ-based, 811 TCP-based, 810–811 building, 813–816 Attribute, 815 service types as operational contracts, 815–816 attribute, 814 building client applications, 824–826 composition of applications, 807–808 contracts, 808 core assemblies, 804 designing data contracts, 835–840 *.svc file, 839 implementing service contracts, 838–839 1373 8229Index.qxd 1374 3/7/08 2:05 PM Page 1374 ■INDEX testing service, 840 updating web.config file, 839 WCF service project template, 836–838 distributed computing APIs, 795–801 COM+/Enterprise Services, 796–797 DCOM, 796 MSMQ, 797 named pipes, 801 NET remoting, 797–798 P2P services, 801 sockets, 801 XML web services, 798–801 hosting, 816–823 App.config file, 816–817 coding against ServiceHost type, 817 enabling metadata exchange, 821–823 host coding options, 818–819 ServiceHost type, 819–820 element, 820–821 as Windows service, 829–833 hosting as Windows service, 829–833 creating installer, 832–833 enabling MEX, 831–832 installing, 833 invoking service asynchronously, 833–835 overview, 795 role of, 801–803 features, 802 SOA, 802–803 Visual Studio project templates, 805–806 WCF Service Library project template, 826–829 math service, 826–827 SvcConfigEditor.exe, 828–829 WcfTestClient.exe, 827–828 WCF Service Library project template, 826–829 math service, 826–827 SvcConfigEditor.exe, 828–829 WcfTestClient.exe, 827–828 WCF Service project template, 806, 836–838 WcfTestClient.exe, 827–828, 840 web applications in ASP.NET, 1256–1258, 1261 web controls in ASP.NET, 1261–1263 web enhancements, NET 3.5, 1230 web page code model, ASP.NET, 1231, 1234 web paradigm, 1229 web parts, 1230 Web Service Description Language (WSDL), 823 Web Services Enhancements (WSE) 3.0, 801 Web Site ‰ Add New Item menu option, 1303 Web Site template, 1242 web.config, ASP.NET, 1257, 1322 web.config file, 839 WebControl base class, 1267 WebControl controls, 1021–1022 WebDev.WebServer.exe, 799, 1218–1219, 1230, 1235 attribute, 502, 798 attribute, 501–502 WebService directive, 799 WebServiceFaultActivity, WF, 847 WebServiceInputActivity, WF, 847 WebServiceOutputActivity, WF, 847 website administration tool, ASP.NET, 1258–1259 website directory structure, ASP.NET, 1242 Web.sitemap file, 1273 WelcomeString, 978 WF (Windows Workflow Foundation) assemblies and core namespaces, 850 brief word regarding custom activities, 878–879 building blocks of getting into flow of workflow, 851–852 integrated services of WF, 845 overview, 844–845 role of sequential workflows and state machine workflows, 848 WF activities, 846–848 building reusable code library, 876–878 building simple workflowenabled application adding Code activity, 852–853 adding custom start-up parameters, 857–859, 861 adding While activity, 854–856 initial workflow code, 852 overview, 852 WF engine hosting code, 856–857 invoking web services within workflows, 859, 872 motivation behind, 843–844 overview, 843 where keyword, generics, 320 where operator, 425, 428–429 Where() method, 422 While activity, 854–856 While clause, 101 while loop, 717 WhileActivity, WF, 847 widening conversions, 90 Widening keyword, 374, 377 widening styles, 1202 widgets, 983, 1221, 1300 Width member, 1108 Width method, Image type, 963 Width property, 892, 954, 1133, 1188, 1267 Width value, 1135 wildcard character (*), 40 Win 32 binaries (*.dll or *.exe), 10 Win32 file header in assemblies, 439 Window class overview, 1055–1056 System.Windows.Controls ContentControl base class, 1056–1057 System.Windows.Controls Control base class, 1057 System.Windows.Dependency Object base class, 1059 System.Windows.Media.Visual base class, 1059 System.Windows.Threading DispatcherObject base class, 1059 System.Windows.UIElement base class, 1058 Window object closing of, 1067–1068 lifetime of, 1065–1067 Window type, 1131, 1142, 1151, 1161, 1168 element, 1071, 1132, 1162, 1183, 1205 Window-derived type, 1171 WindowLeft property, 74 8229Index.qxd 3/7/08 2:05 PM Page 1375 ■INDEX element, 1200 Windows Application project, 986 Windows collection, 1065 Windows Communication Foundation Service See WCF (Windows Communication Foundation) Service Windows Control Library project, 1028 Windows Distributed interNet Applications Architecture (DNA) deficiencies, Windows Forms, 883–927, 1047 Application class, 887–890 building front end, 735–736 building main windows by hand, 885–886 ContextMenuStrip control, 905–912 context-sensitive pop-up menus, 909–911 overview, 905–907 ToolStripMenuItem Type, 911–912 Control class, 891–896 determining which mouse button was clicked, 895 MouseMove event, 894–895 overview, 891–893 responding to keyboard events, 896 Form class, 896–900 anatomy of, 890–891 life cycle of Form-derived types, 898–900 overview, 896–898 MDI applications, 924–926 child forms, 925 child windows, 925–926 overview, 924 parent forms, 924–925 MenuStrip control, 905–912 adding TextBox to, 908–909 overview, 905–907 ToolStripMenuItem Type, 911–912 overview, 883 separation of concerns principle, 886–887 StatusStrip type, 913–919 designing, 914–917 designing menu systems, 914 displaying menu selection prompts, 918–919 establishing “Ready” state, 919 overview, 913 Timer type, 917 toggling displays, 917–918 System.Windows.Forms namespace, 883–885 ToolStrips type, 919–923 overview, 919–922 ToolStripContainer control, 922–923 Visual Studio 2008, 900–905 dissecting projects, 902–903 implementing events at design time, 904 overview, 900–902 StartUp Object/Main() sub distinction, 904–905 Windows objects and Graphics objects, GDI+, 936 Windows Open dialog box, 513 Windows Presentation Foundation See WPF (Windows Presentation Foundation) Windows property, Application type, 1054 Windows Vista operating system, 1049 Windows Workflow Foundation See WF (Windows Workflow Foundation) Windows Workflow toolbox, 846 Windows XP Home Edition and ASP.NET, 1218–1219 WindowsBase.dll assembly, WPF, 1053 WindowsFormsDataTableViewer application, 721 WindowState property, 897 WindowToolStripMenuItem member variable, 925 WindowTop property, 74 With construct, 102, 133 With keyword, 102 WithEvents keyword, 342–343, 344, 903, 1061 WithEvents modifier, 350 Wizard definition, 1283 Wizard web control, 1282 wizards, worker thread, 518 WorkflowCompleted event, 857 workflow-enabled application, 844 WorkflowInstance core type, 856 WorkflowRuntime core type, 856 WorkflowTerminated event, WorkflowRuntime, 857 world coordinates, 939 WPF (Windows Presentation Foundation) assemblies overview, 1053–1054 role of Application class, 1054–1055 role of Window class, 1055–1059 building WPF applications using Visual Studio 2008, 1091–1095 building XAML-free WPF applications creating simple user interface, 1062–1063, 1070 extending Window class type, 1061–1062 overview, 1060–1061 controlling content layout using panels, 1156 motivation behind overview, 1047–1048 providing optimized rendering model, 1049 providing separation of concerns via XAML, 1049 separation of concerns using code-behind files, 1078–1080 transforming markup into NET assembly mapping XAML to C# code, 1074–1075 overview, 1074 role of Binary Application Markup Language (BAML), 1075–1076 XAML-to-assembly process summary, 1077–1078, 1099 XAML attached properties, 1085–1086 Browser Applications (XBAPs), 1051–1052 defining application object in, 1071–1072 defining MainWindow in, 1071 elements and attributes, 1082–1083 markup extensions, 1087–1088 overview, 1070 1375 8229Index.qxd 1376 3/7/08 2:05 PM Page 1376 ■INDEX processing at runtime, 1095–1099 processing XAML files via msbuild.exe, 1072–1073 property-element syntax, 1083–1085 type converters, 1086–1087 WPF 2D graphical rendering services, 1167–1211 animation, 1187–1195 Animation-suffixed types, 1187–1188 authoring in VB code, 1189–1190 authoring in XAML, 1191–1192 key frames, 1193–1195 looping, 1191 pacing, 1190–1191 reversing, 1191 Timeline base class, 1188 brushes, 1177–1179 gradient, 1178–1179 ImageBrush type, 1179 SolidColorBrush type, 1177–1178 Drawing-derived types, 1181–1185 DrawingBrush types, 1183 DrawingImage types, 1182–1183 geometry types, 1181–1182 overview, 1167 pens, 1180 philosophy of, 1167–1174 resource system, 1195–1198 binary resources, 1196–1197 object (logical) resources, 1198 object resources, 1198 Shape-derived types, 1175–1177 transformations, 1185–1187 WPF controls altering UI with templates, 1207–1211 styles for, 1198–1206 WPF controls, 1103–1165 altering UI with templates, 1207–1211 adding triggers to, 1208–1209 custom, 1207–1208 incorporating into styles, 1210–1211 button types, 1116–1120 Button type, 1117 ButtonBase type, 1116–1117 RepeatButton type, 1119–1120 ToggleButton type, 1118 CheckBox types, 1120–1123 establishing logical groupings, 1121 framing related elements, 1121–1123 ComboBox types, 1123–1128 adding arbitrary content, 1125–1126 determining current selection, 1126–1128 filling list controls programmatically, 1124–1125 commands, 1147–1150 connecting, 1148–1150 intrinsic control command objects, 1147 data binding, 1150 custom objects, 1156–1160 DataContext property, 1152 IValueConverter interface, 1153–1156 Mode property, 1153 XML documents, 1161–1164 declaring in XAML, 1106–1108 dependency properties, 1108–1112 defining wrapper properties for DependencyProperty field, 1111–1112 existing, 1109–1110 registering, 1110–1111 library, 1103–1106 ListBox types, 1123–1128 adding arbitrary content, 1125–1126 determining current selection, 1126–1128 filling list controls programmatically, 1124–1125 nested panels, 1141–1147 finalizing design, 1145 finalizing implementation, 1146–1147 menu system, 1142 StatusBar type, 1144 ToolBar type, 1143–1144 overview, 1103 panels, 1131–1141 Canvas panels, 1133–1135 DockPanel panels, 1140 enabling scrolling for, 1141 Grid panels, 1137–1139 StackPanel panels, 1136–1137 types of, 1132–1133 WrapPanel panels, 1135–1136 RadioButton types, 1120–1123 routed events, 1112–1116 bubbling, 1113–1115 tunneling, 1115–1116 styles for, 1198–1206 assigning implicitly, 1203 assigning programmatically, 1205–1206 defining with triggers, 1203–1204 inline, 1198–1199 named, 1199–1200 narrowing, 1202 overriding settings, 1201 subclassing existing, 1201 widening, 1202 text areas, 1129–1131 PasswordBox type, 1130–1131 TextBox type, 1129–1130 WPF Interoperability, 902 WPF resource system, 1195–1198 binary resources, 1196–1197 Content Build Action, 1197 Resource Build Action, 1196–1197 object (logical) resources, 1198 object resources, 1198 Wrap property, DomainUpDown, 1014 WrapPanel control, 1104, 1132, 1135–1136 element, 1162 wrapper properties, 1111–1112 Write() method, 74, 621, 623, 627, 1241, 1251, 1252 WriteAllBytes() method, 619 WriteAllLines() method, 619 WriteAllText() method, 619 WriteFile() method, 74–75, 142, 623, 1251 write-only class properties, 160 WriteOnly keyword, 154, 160 write-only property, 160 WriteXml() method, 708, 718 WriteXmlSchema() method, 708, 718 writing to text file, 624 WSDL (Web Service Description Language), 823 wsdl.exe command-line tool, 800 WSDualHttpBinding class, 810 8229Index.qxd 3/7/08 2:05 PM Page 1377 ■INDEX WSE (Web Services Enhancements) 3.0, 801 WSFederationHttpBinding class, 810 WSHttpBinding class, 831 WSHttpBinding option, 809 WSHttpBinding protocol, 810, 827 X X or x string format, NET, 76 X property, 895 XAML (Extensible Application Markup Language), 1047, 1103 attached properties, 1085–1086 authoring animation in, 1191–1192 Browser Applications (XBAPs), 1051–1052 building XAML-free WPF applications creating simple user interface, 1062–1063, 1070 extending Window class type, 1061–1062 overview, 1060–1061 declaring WPF controls in, 1106–1108 defining application object in, 1071–1072 defining MainWindow in, 1071 elements and attributes, 1082–1083 mapping to C# code, 1074–1075 markup extensions, 1087–1088 overview, 1070 processing at runtime, 1095–1099 processing XAML files via msbuild.exe, 1072–1073 propery-element syntax, 1083–1085 type converters, 1086–1087 *.xaml files, 1073, 1077, 1103, 1179 XAttribute member, 781 XAttributes object, 784 XBAPs (Browser Applications), XAML, 1051–1052 x/COL/Type markup extension, 1202 XComment member, 781 Xcopy deployment, 460 XDeclaration member, 781 XDocument member, 781 XDocument type, 786 XElement member, 780 XElement parameter, 790 XElement type, 786 XElement.Descendants() method, 790 XElement.Load() method, 789 XElement.Parse() method, 788 XElements object, 784 XML and ADO.NET, 654 blending programming constructs within literals, 782–783 /doc compiler flag, 167 documentation elements, 165 documenting VB 2008 source code via, 165–168 navigating in-memory XML documents, 789–790 overview, 781 programmatically creating elements, 783–784 programmatically creating XML documents, 785 serializing DataTable/DataSet objects as, 718–719 source code documentation, 165–166 storing literals in string data types, 782 XML documents, 788–791, 1161–1164 custom dialog boxes, 1161–1164 DialogResult property, 1163 loading XML content, 788 modifying data in, 790–793 obtaining current selection, 1163–1164 parsing XML content, 788 programmatically creating, 783–786 System.Xml.XLinq namespace, 780–783 *.xml file, 167, 1162 XML web services, 798–801 attribute, 643 XML-based configuration files, 439 XmlDataProvider type, 1162 attribute, 643 attribute, 643 xmlns attribute, 1220 XmlReader/XmlWriter models, 779 attribute, 643 XmlSerializer, 637, 641–643 attribute, 643 attribute, 643 XName/XNamespace member, 781 XPath bindings, 1162 xPos member variable, 401 Y y operators, 410 Y property, 895 yPos member variable, 401 1377 ... 8229FM.qxd 3/ 5/ 08 4: 23 PM Page i Pro VB 2008 and the NET 3. 5 Platform Andrew Troelsen 8229FM.qxd 3/ 5/ 08 4: 23 PM Page ii Pro VB 2008 and the NET 3. 5 Platform Copyright © 2008 by Andrew Troelsen... 8229CH01.qxd 12/ 13/ 07 3: 35 PM PART Page 1 Introducing Visual Basic 2008 and the NET Platform 8229CH01.qxd 12/ 13/ 07 3: 35 PM Page 8229CH01.qxd 12/ 13/ 07 3: 35 PM CHAPTER Page The Philosophy of NET E very... Basic NET and the NET Platform: An Advanced Guide (Apress, 2001), and the award-winning C# and the NET Platform (Apress, 20 03) Andrew has also authored numerous articles on NET for MSDN, DevX, and

Ngày đăng: 20/03/2019, 10:34

TỪ KHÓA LIÊN QUAN