Professional Visual Basic® 2010 and neT inTroducTion xxxv ⊲ ParT i language consTrucTs and enVironmenT chaPTer Visual Studio 2010 chaPTer Objects and Visual Basic 67 chaPTer Custom Objects 137 chaPTer The Common Language Runtime 211 chaPTer Declarative Programming with Visual Basic 253 chaPTer Exception Handling and Debugging 267 chaPTer Test-Driven Development 287 ⊲ ParT ii Business oBJecTs and daTa access chaPTer Arrays, Collections, and Generics 311 chaPTer Using XML with Visual Basic 341 chaPTer 10 ADO NET and LINQ 389 chaPTer 11 Data Access with the Entity Framework 437 chaPTer 12 Working with SQL Server 457 chaPTer 13 Services (XML/WCF) 507 ⊲ ParT iii smarT clienT aPPlicaTions chaPTer 14 Windows Forms 541 chaPTer 15 Advanced Windows Forms 575 chaPTer 16 User Controls Combining WPF and Windows Forms 599 chaPTer 17 WPF Desktop Applications 617 chaPTer 18 Expression Blend 667 chaPTer 19 Silverlight 679 ⊲ ParT iV inTerneT aPPlicaTions chaPTer 20 Silverlight and Services 699 chaPTer 21 Working with ASP NET 719 chaPTer 22 ASP NET Advanced Features 751 chaPTer 23 ASP NET MVC 787 chaPTer 24 SharePoint 2010 Development 807 ⊲ ParT V liBraries and sPecialiZed ToPics chaPTer 25 Visual Studio Tools for Office 843 chaPTer 26 Windows Workflow Foundation 881 chaPTer 27 Localization 905 chaPTer 28 COM-Interop 929 chaPTer 29 Network Programming 949 chaPTer 30 Application Services 981 chaPTer 31 Assemblies and Reflection 1001 chaPTer 32 Security in the NET Framework 1021 chaPTer 33 Parallel Programming Using Tasks and Threads 1051 chaPTer 34 Deployment 1101 aPPendix a The Visual Basic Compiler 1137 aPPendix B Visual Basic Power Packs Tools 1151 aPPendix c Workflow 2008 Specifics 1165 aPPendix d Enterprise Services 1185 aPPendix e Programming for the Cloud 1205 index 1233 Professional Visual Basic® 2010 and neT Professional Visual Basic® 2010 and neT Bill Sheldon Billy Hollis Kent Sharkey Jonathan Marbutt Rob Windsor Gastón C Hillar Professional Visual Basic® 2010 and neT Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-50224-2 Manufactured in the United States of America 10 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 Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties 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 suitable 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 Web site 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 Web site may provide or recommendations it may make Further, readers should be aware that Internet Web sites 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 (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002 Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Library of Congress Control Number: 2010921246 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks 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 To my wonderful wife, Tracie, who is forced to carry on while I isolate myself to concentrate on writing And to the next generation of children who have joined our extended Sheldon family (my own and my brothers’) in the past five years — Nick, Elena, Ben, Billy V, Abigail, and Johnny — each and every one of you is a valuable part of our lives —Bill Sheldon I owe tremendous thanks to my family, who have somehow learned to put up with marathon writing sessions, and to my business partner, Gary Bailey, for keeping our clients happy while I’m writing —Billy Hollis To Babi, for keeping me alive and putting up with me — hopefully, for a long time to come —Kent Sharkey To my beautiful wife, Jennifer, who was my greatest encouragement despite the long days of writing and working And to my loving daughter, Kathryn, who always managed to put a smile on my face after a long day —Jonathan Marbutt To my Dad, who did not complain too much about the weekends I spent writing instead of playing golf with him —Rob Windsor To my son, Kevin —Gastón Hillar sharePoint – sockets SharePoint (continued) Solution Framework, 817–820 SQL Server, 846 templates, 62 TFS, 62 Visual Studio, 821–827 Web Parts, 833–838 Workflow, 13 SharePoint Connections, 57 SharePoint Foundation, 808 SharePoint Management Shell, 818 SharePoint Server, 808 Sheldon, Bill, Short, 75, 76, 81–82 shortcuts, File System Editor, 1114 ShouldSerialize, 580 Show, 549 ShowColor, 567 ShowDialog, 549, 566, 567 ShowDistance, 191, 195, 196 ShowEffects, 567 ShowMessage, 971 SID See Security Identifier side-by-side versioning, 215, 1009 signaling, 1093 signing, 28 strong names, 1004–1005 Silverlight, 253, 679–695 Add Service Reference, 701 ADO.NET, 705–714 App.xaml, 683 ASP.NET, 682 ClientBin folder, 682 controls, 685 DRM, 680 HelloWorldComplete, 701–702 high-definition video, 680 MVVM, 714–718 New Project, 13 object models, 827 Out of the Browser, 694–695 projects, 680–682 Smooth Streaming, 680 SOAP, 700–702 WCF, 702–705 Web Services, 699–718 1264 WPF, 645 Silverlight Application Class, 693 Silverlight Child Window, 694 Silverlight Class Library, 682 Silverlight Navigation Application, 681 Silverlight Page, 693–694 Silverlight Resource Dictionary, 694 Silverlight User Control, 693 Simple Mail Transfer Protocol (SMTP), 509, 950, 969 Simple Object Access Protocol (SOAP), 491, 700–702, 704 WCF, 514 Web Services, 511 Single, 76, 83–84 single-level inheritance, 205 SiteMapDataSource, 735, 760–761 siteMapNode, 758–760 Size, 44 Sizeable, 544 SizeableToolWindow, 544 SizeType, 556 SketchFlow, 667–668, 674–678 SketchFlow Map, 674–675 SketchFlow Player, 676–678 $skip, 500 smart-client deployment, 216 Smooth Streaming, Silverlight, 680 SMTP See Simple Mail Transfer Protocol SmtpPort, 1228 SmtpServer, 1228 Sn.exe, 1035 Snippet Editor, 39 snippet library, 37 SOA See service-oriented architecture SOAP See Simple Object Access Protocol SoapFormatter, 969 Socket, 973 sockets applications, 960–962 Conversation window, 962–968 errors, 974 Message, 969–973 networks, 960–976 ports, 960 protocols, 969 solution Configurations – static SMTP, 969 SSL, 1047–1049 TCP/IP, 960 TcpListener, 962 threads, 961, 963 Solution Configurations, 45 Solution Explorer, 14–15, 104, 235 Solution Framework, 817–820 SolutionID, 817 sort culture, 915–916 NET, 915–916 routines, 130–131 SortedList, 316 Source, 268, 277–278, 282, 1036 source, 1068, 1070 Source Code Style attributes, XML, 347–348 SourceExists, 282 SourceItems, 589 SourceListBox, 587–588 spaghetti code, 205 SPContext, 831 SPDataSource, 813 specific culture, 906 SplashScreen, 244 Split, 89 SplitButton, 564 SplitContainer, 554–555 Splitter, 554 SPSite, 829 SPWeb, 829 SQL, 399, 400 See also LINQ to SQL; Transact-SQL templates, 57 Windows Azure, 1212 SQL cache invalidation, 720 SQL Management Studio, 479 SQL Server, 5, 457–505 ASP.NET, 720, 763–765 CLR, 470 debugging, 22 functions, 476–482 NET, 473 data providers, 409 SharePoint, 846 stored procedures, 483–489 T-SQL, 470–471 UDT, 471–483 Web Services, 489–494 XML, 468–470 SqlCommand, 406–407 asynchronous, 404 ExecuteReader, 403 SqlDataReader, 488 SqlConnection, 398–399, 416 SqlDataAdapter, 406 SqlDataReader, 401–402, 486, 488 SqlDataRecord, 486 SqlDataSource, 735–743 -sqlexportonly ,filename., 763 SQLFunction, 476–482 SQLFunctionAttribute, 477 SqlMetaData, 486 SqlPipe, 485–486 SQLUserDefinedType, 471–483 SSL See Secure SocketsLayer Stack, Collections, 316 StackPanel, 662, 690–691 stacks, 74 StackTrace, 268, 277–278 Standard Generalized Markup Language, XML, 509 Standard Toolbar, 45 Start, 994 Start Debugging, 49 Start stage, User Interface Editor, 1119 StartsWith, 289 StartType, 986 ,startup., 1011 state, 254 State, 1172 state, 479 state machine workflows, 1166–1167 StateFinalization, 1172 StateInitialization, 1172 statements, 10 conditional, 76–79 iterative, 317–319 loops, 76–79 ReDim, 314–315 States window, Expression Blend, 672–673 Static, 11 1265 staticresources – symmetric key encryption StaticResources, 641 Status, 995, 1081 STDistance, 494 Step-In, 49–50 Step-Out, 50 Step-Over, 50 Stop ParallelLoopState, 1073 ServiceController, 994 Stop Debugging, 49 storage model, XML, 442–443 Storage services, Windows Azure, 1210–1212 Storeadm.exe, 1035 Stored Procedure, 425 stored procedures, 399–402 ADO.NET, 484 app.config, 402 calling, 401–402 SQL, 400 SQL Server, 483–489 SQL to LINQ, 432–433 T-SQL, 401, 458, 471 Visual Studio, 400–401 StorePermission, 1025 StorePermissionAttribute, 1025 stream-based XML documents, 348 XmlReader, 351–359 XmlWriter, 349–351 StreamWriter, 283 street, Geocode, 479 String, 87–88 Constants, 90–91 constructors, 166 immutability, 89–90 Integer, 36 primitive data types, 75, 76 SqlFunctionAttribute, 477 SQLUserDefinedType, 472 Windows Services, 998 String ToString(), 217 StringAssert, 289 String.Format, 92 String.Split, 89 strMyString, 90 strNothing, 93 strong names, 1027 1266 assemblies, 1004–1005 encryption, 1193–1194 GAC, 1007 strongly typed objects, LINQ, 425 settings, 26 ShowDistance, 196 variables, 190 StrongNameIdentityPermission, 1025 StrongNameIdentityPermissionAttri, System Security.Permission, 1025 StrongNamePublicKeyBlob, 1025 Structure, 332, 336 stylesheet, 363 Sub, ButtonText, 74 Load, Main, 10 parameters, 93 reflection, 1016 Return, Sub Sub Sub Sub Sub Sub AddInput(InputValue as Double), 931 DoCalculation(), 931 Main, 543 Reset(), 931 Sorting, 915 TestFileIOPermission(), 1033 subclass, 139 base class, 168 creating, 141–143 MyBase, 163 Overrides, 153 Private, 168 Public, 168 raising events, 171–173 shadowing, 162 virtual methods, 148–151 SubmitChanges, 427 subs, SubString, 88 subtract, 86 superclass, 139 Suspend, 1173 SuspendLayout, 31 Switch,T., 888 symmetric key encryption, 1040–1043 sync framework – system.Xml.Xsl Sync Framework, 464–468 synchronization primitives, 1093 SQL Server Compact, 462–468 syntax, 7–10 build engine, XAML, 258–262 System, Collections, 315 Exception, 269 referenced libraries, 22 System.Activities.XamlIntegration, 900 System.AggregateException, 1089–1090 System.Collections, 237 System.Collections.Concurrent, 1068 System.Collections.Generic, 237 System.Collections.Queue, 970 System.ComponentModel.Component, 135, 226 System.Configuration.Install.Inst, Windows Services, 984 System.Core, 22 System.Data, 22, 237, 269, 395 SystemDataAccess, 477 System.Data.Common, 395 System.Data.DataSetExtensions, 22 System.Data.EntityClient, 396 System.Data.Linq, 396 System.Data.Odbc, 396 System.Data.OleDb, 396 System.Data.Services, 396 System.Data.SqlClient, 396 System.Deployment, 22 System.Diagnostics, 237 System.Drawing, 22, 237, 591 System.Drawing.Graphics, 591–592 System.EnterpriseServices, 237 System.Environment.ProcessorCount, 1070 System.IO, 237 System.Linq, 237 System.Net networks, 953–960 WebClient, 958–960 System.Net.IPEndPoint, 965 System.Net.Sockets.Socket, 973 System.Net.Sockets.TcpListener, 961 System.Net.TcpClient, 960 System.Net.TcpListener, 960 System.Object, 9, 72, 132, 328 base class, 147 CTS, 217 inheritance, 141 NET Framework, 159 System.Reflection, 1013 Assembly, 220 AssemblyCulture, 1006 late binding, 193 System.Runtime.Serialization.Formatters, 969 Systems.Collections.Concurrent, 1094 System.Security.Cryptography, 1040 System.Security.Cryptography AssymetricAlgorithm, 1043 System.Security.Cryptography HashAlgorithm, 1038 System.Security.Permissions, 1021, 1023–1029 System.ServiceModel, 521 System.ServiceProcess.ServiceBase, 984 System.ServiceProcess.ServiceInst, 984 System.ServiceProcess.ServiceProc, 984 System.Text, 237 System.Text.StringBuilder, 74–75 System.Threading, 237 System.Threading.ReaderWriterLock, 970 System.Threading.Tasks.Parallel, 1052 System.Threading.Tasks.Task, 1080–1081 System.Threading.Thread, 961 System.Transaction, 418–421 System.Web, 237 System.Web.Services, 237 System.Windows, 44 System.Windows.Forms, 22, 237, 541, 627 System.Windows.Forms.Form, 44 System.Windows.Forms.MessageBox, 42 System.Workflow.Activities, 1170–1173 System.XML, 22, 269 System.Xml, 341, 348 System.XML.Linq, 22 System.Xml.Linq, 342 System.Xml.Schema, 341 System.Xml.Serialization, 343–348 System.Xml.XPath, 341 System.Xml.Xsl, 342 1267 Tab key – TextBox T Tab key, 35 TabControl, 570 TabIndex, 44 Table, 425 ,table., 724 tables EF, 448–452 multiple objects, 448–450 Windows Azure storage, 1210–1211, 1217–1222 Table(TEntity), 428 TableDefinition, 477 TableLayoutPanel, 556, 587–588 TableServiceContext, 1218 /target, 1140 Target Framework, Windows Forms, 954 TargetListBox, 587–588 TargetSite, 268, 276–279 Task, 1085–1086 tasks, 1079–1099 asynchronous, 1083 cancellation tokens, 1086–1089 CLR, 1084 continuations, 1092 exceptions, 1089–1090 life cycle, 1081–1082 parallelism, 1051–1057, 1082–1090 threads, 1080 values, 1090–1092 Task List, 56–57 Task Parallel Library (TPL), 1052 classes, 1061 hardware threads, 1079 load-balancing, 1070 methods, 1061 System.Collections.Concurrent, 1068 TaskContext, 1218 TaskCreationOptions, 1092 TaskGrid, 1220 TaskScheduler, 1078 TaskStatus.Canceled, 1082 TaskStatus.Created, 1082 TaskStatus.Faulted, 1082 TaskStatus.RanToCompletion, 1082 TaskStatus.WaitingForActivation, 1082 TaskStatus.WaitingToRun, 1082 1268 Task.WaitAll, 1085–1086 TcpClient, 973 BinaryFormatter, 970 ConnectForm, 968 Conversation window, 963, 973 Deserialize, 970 GetStream, 961 Socket, 973 TCP/IP, 508, 951, 960 TcpListener, 962, 968 TDD See test-driven development Team Explorer, 62 Team Foundation Server (TFS), 61–62 Team Project Collections, 62 tear-away tabs, 32 template, XSLT, 363 templates See also classes methods, 42 projects, 11–14, 1104–1105 SharePoint, 62 SQL, 57 SQL Database, 57 VSTO, 845 Terminate, 1173 TerminateWorkflow, 888, 893 Test attributes, 295 query expression, 429 Test Results window, 291 Test View window, 290 TestCleanup, 295 test-driven development (TDD), 287–307 assertions, 288–290 classes, 302 IntelliSense, 302 tools, 290–291 TestInitialize, Test, 295 Text, 44 ASP.NET, 732 resources, 919 Run Code, 41 TextBox, 54 Web Services, 492 Text Editor, 33 TextBox, 52, 142 Conversation window, 963 TextBoxrounding – TryCatch System.Net, 957 Text, 54 ToolStrip, 564 Web Services, 492 Windows Forms, 923 Windows.Forms, 570 WPF, 622 TextBoxRounding, 609 TFS See Team Foundation Server themes, ASP.NET, 722 theOrder, 895 third-parties TDD, 306–307 Windows Forms controls, 576 ThreadEntryPoint, 961 threads ASP.NET, 907 CLR, 1080 culture, 907–908 hardware, 1053, 1078–1079 InitiateConnection, 968 main, 1083 sockets, 961, 963 tasks, 1080 Windows Forms, 907, 962 WithEvents, 117 thread-safe collections, 1094 Thread.Sleep, 319 Throw, 269–270, 271–273 WF, 888, 1173 Timeout, 953 TimeOutException, 1075 Timer, 570 Timespan, 86 Title, 453 applications, 1107 siteMapNode, 759 TlbExp, 947 TlbImp.exe See Type Library Import TLS See Transport Layer Security Today, 85 TODO, 56 toExclusive, 1063 Toolbar, 562–564 Toolbox, 40 Expression Blend, 669–670 Visual Studio, 639 Windows Forms, 595 WPF, 645 ToolStrip, 562–564 ToolTip IDE, 42 resources, 919 Windows Forms, 557 $top, 500 TopMost, 544 ToString, 72, 80, 100, 269, 328 classes, 160 Me, 160 Message, 969–970 overrides, 160 UDT, 473 TPL See Task Parallel Library Trace, 21–22 trace files, 283–284 Track Changes, 33 TrackBar, 570 TransactedReceiveScope, 888 Transaction, 426–427, 428 transactions ADO.NET, 418–421 components, 1187–1197 Enterprise Services, 1185–1198 JIT, 1197–1198 queued components, 1202–1204 TransactionScope, 888 Transact-SQL (T-SQL), 254, 457–458 functions, 471 SQL Server, 470–471 stored procedures, 401, 458, 471 Web Services, 471 XML, 471 Transform, 366 Transitive, 1114 Translate, 427 TransparencyKey, 546 Transport Layer Security (TLS), 1047 trappable errors, 102 TreeView, 570 trickle-feed, 1125 Try, 269, 270–271 Catch, 274–275 TryCast, 103 TryCatch, 888, 974 1269 Try-Catch – values Try-Catch, 101 Try Catch, 279 TryParse, 100–101 T-SQL See Transact-SQL Type GetMembers, 1015 metadata, 220 reflection, 1013, 1015–1016 types See also data types; user-defined types constraints, 334–335 generics, 322–326 creating, 327–333 GetType, 1015 NET, 214 nullable, 322 Type GetType(), 217 Type Library Import (TlbImp.exe), 935–936 TypeDescriptorPermission, 1025 TypeLoadException, 1012 TypeMock, 306 u -U ,login., 763 UAC See User Access Control UBound, 314 UDT See user-defined types uiAccess, 1034 UICulture, 244, 918 UInt16, 81, 82 UInt32, 81, 82 UInt64, 81, 82 UIPermission, 1025 UIPermissionAttribute, 1025 UML See Unified Modeling Language Unattended Execution, 217 Unified Modeling Language (UML), 139, 452 Union, 1026 Universal Coordinated Time, 85 unmanaged code, 22 unsigned data types, 82 UpdateCommand, 742 UpdateModel, 803 ,UpdateParameters., 742 UriChanged, 661 Url 1270 SecurityException, 1036 siteMapNode, 759 UrlEncode, 955 UrlIdentityPermission, 1025 UrlIdentityPermissionAttribute, 1025 UseDevelopmentStorage, 1219 User Access Control (UAC), 1028, 1032–1036 View Windows Settings, 15–16 Visual Studio, 1033 User account, Service Control Manager, 983 User Interface Editor, 1118–1120 dialogs, 1119–1120 installation modes, 1118 User Tasks, Task List, 56 UserControl, 585–590 WPF, 647 UserDefined, 472 user-defined types (UDT) Parse, 473 SQL Server, 471–483 ToString, 473 UserID, 1228 username, 969 UsernameField, 963 user-specific settings, 26 UseVisualStyleBackColor, 44 UseWaitCursor, 553 Using, 224 UtcNow, 85 /utf8output[1:2], 1148 V Validating, Windows Forms, 561–562 ValidationErrors, 895 ValidationMessage, 803 ValidationMethodName, 472 ValidationSummary, 803 $value, 500 %value, 955 value-of, 364 values behavior, 74 data types, 73–75, 79–86 Function, methods, 9, 106 ValueType() – Visual studio Tools for office (VsTo) NET, 73–75, 214 Optional, 93 registry, 1115–1116 tasks, 1090–1092 ValueType(), 74 ValueType, 328 VariableName, 35–36 variables For, 95 Dim, Friend, 169 If Then, 95 New, Nothing, Protected scope, 169–170 Public, 169 scope, 94–95 Shared, 124–125 strongly typed, 190 virtual methods, 149 vb, 103 VBA See Visual Basic for Applications vbc.exe.config, 1137–1139 vbCRLF, 80 vbc.rsp, 1148–1149 /vbruntime[1:2], 1148 vector graphics, 619 ver, 1006 /verbose, 1145 versions ADO.NET, 216 assemblies, 1004, 1008–1013 CLR, 214–216 NET Framework, 12–13, 25, 1103 side-by-side, 215 TFS, 62 View ASP.NET MVC, 793–796 MVVM, 717 Other Windows, 57 View, 425 View Application Events, 16 View Windows Settings, 15–16 ViewData, 793 ViewState, 731–732, 1036 virtual methods, 148–151 methods signatures, 148 Overrides, 152 Visual Basic for Applications (VBA), 843, 847–852 Visual Basic Migration Wizard, 75 visual inheritance, 30 Visual InterDev, 57 Visual Source Safe (VSS), 61 Visual Studio ASP.NET, 721–723 Class Designer, 139 COM, 931 dll, 935–936 components, 134 debugging, 998 deployment, 1103–1109 editions, 6–7, 305–306 EF, 440, 452–454 Expression Blend, 669 global resources, 922 Mapping Details, 446 permissions, 478 projects, 1103–1109 Resources folder, 637 SharePoint, 821–827 stored procedures, 400–401 Toolbox, 639 UAC, 1033 VSTO, 844 WCF, 516 Windows Azure, 1213–1231 Windows Forms, 954 Windows Forms controls, 578–578 XSLT, 363 Visual Studio Extensions for Windows SharePoint Services (VSeWSS), 821 Visual Studio Tools for Office (VSTO), 6–7, 13, 843–880 Add-In, 845 Document/Workbook, 845 Excel, 864–871 IntelliSense, 852 NET, 843 Office automation, 844 OFR, 871–880 PIA, 844–845 projects, 845–846 1271 Visual studio Tools for office (VsTo) – Windows Communication foundation Visual Studio Tools for Office (VSTO) (continued) templates, 845 VBA, 847–852 Visual Studio, 844 Word, 852–864 Visual Web Developer 2010 Express Edition, visualizers, 49 VisualWebPart1UserControl.ascx, 833 VisualWebPart.vb, 833 VisualWebPart1.webpart, 833 Vital, 1108 VScrollBar, 570 VSeWSS See Visual Studio Extensions for Windows SharePoint Services VSS See Visual Source Safe VSTO See Visual Studio Tools for Office W -W, ASP.NET SQL Server Setup Wizard, 763 WaitAll, 1085–1086 /warnaserror[1:2], 1143 WAS See Windows Process Application Service Watch window, 46 debugging, 52 WCF See Windows Communication Foundation Web Deployment Tool, IIS, 1133–1134 Web Forms ASP.NET, 720, 723–735 events, 728–729 components, 134 Web Parts, 13, 833–838 Web Service Enhancements (WSE), 507 Web Services, 949 IIS, 981 NET, encryption, 1022 Silverlight, 699–718 SOAP, 511 SQL Server, 489–494 Textbox, 492 T-SQL, 471 XML, 507–538 Web Setup Project template, 1105 WebBrowser COM, 976 1272 LinkLabel, 978 Navigate, 978 Windows.Forms, 570 WebBrowserPermission, System.Security Permission, 1025 WebBrowserPermissionAttribute, 1025 WebClient, 958–960 web.config, 14 WebRequest child class, 954 networks, 953–960 WebResponse, 953–960 WebServiceFault, 1171 WebServiceInput, 1171 WebServiceOutput, 1171 WF See Windows Workflow Foundation Where, 429 While, 318–319 WF, 888, 1171 window handles, Windows Forms, 614–615 Windows applications, Internet deployment, 1124–1133 New Project, 13 registry, 14 Windows UAC, 1032 Windows Services, 982 Windows API Code Pack, NET Framework, 948 Windows Azure, 1205–1231 Compute services, 1213 deployment, 1229–1231 Fabric, 1208–1210 projects, 1215–1217 SQL, 1212 Storage services, 1210–1212 Visual Studio, 1213–1231 Windows Communication Foundation (WCF), 14, 516–537, 949 app.config, 528–529 applications, 514 consumer, 523, 534–536 customBinding, 704 DS, 458, 495, 497–501 client library, 501–505 host, 533–534 IIS, 981 IntelliSense, 531 Windows forms – Windows forms interfaces, 517–518 namespaces, 533 New Project, 14 Service Reference, 523–527 Silverlight, 702–705 SOAP, 514 Visual Studio, 516 Windows Forms, 541–574 AddOwnedForm, 544 AddPropertyMap, 609–610 advanced, 575–597 anchoring, 554 Application, 543 applications, 604–610 AutoCompleteMode, 559–560 AutoScroll, 547 Button, 923 CausesValidation, 562 CheckedListBox, 582–584 ColorDialog, 567 components, 134 composite controls, 576–577 ContextMenuStrip, 564–565 Control, 552, 585 controls, 552–573, 575–597, 599–616 ActiveX, 576 attributes, 579–581 base class, 584–586 Browsable, 581 building, 591–595 Category, 581 ComboBox, 576 customization, 576 Description, 581 embedding, 595–597 events, 581–582 IDE, 580 inheritance, 576–584 NET Framework, 576 NumericUpDown, 576 properties, 578 runtime, 572–573 third-parties, 576 WPF, 610–614 culture, 924 DialogResult, 549–550 dialogs, 566–567 docking, 553–554 DragDrop, 568–569 ErrorProvider, 558 extender providers, 557–559 FlowLayoutPanel, 555–556 FontDialog, 567 FormBorderStyle, 544 GDI1, 592–595 GroupBox, 556–557 HelpProvider, 558 HTML, 976–979 HWnd, 614–615 inheritance, 547 instances, 551 Label, 923 LimitedCheckedListBox, 582–584 Localizable, 924 Margin, 555–556 MaskedTextbox, 560–561 MaximumSize, 552–553 menus, 564–566 runtime, 565–566 MenuStrip, 564–565 MinimumSize, 552–553 NET Framework, 541 Opacity, 545–546 OpenFileDialog, 566 OwnedForms, 545 Owner, 544–545 Padding, 555–556 PageSetup-Dialog, 567 Panel, 556–557 PrintDialog, 567 PrintDocument, 567 PrintPreviewDialog, 567 PropertyMap, 609–610 Region, 546 resources, 923–927 resx, 923 runtime, 550–551 SaveFileDialog, 566 ShowDialog, 549 SizeType, 556 SplitContainer, 554–555 Splitter, 554 Sub Main, 543 TableLayoutPanel, 556 1273 Windows forms – Windowstyle Windows Forms (continued) Target Framework, 954 TextBox, 923 threads, 907, 962 Toolbar, 562–564 Toolbox, 595 ToolStrip, 562–564 ToolTip, 557 TopMost, 544 TransparencyKey, 546 UserControl, 585–590 UseWaitCursor, 553 Validating, 561–562 Visual Studio, 954 window handles, 614–615 WPF, 541 controls, 601–610 Windows Installer, 1102–1103 Windows Presentation Foundation (WPF), 253 applications, 617–666 behavior, 626–631 binding, 648, 660–665 Button, 622 buttons, 641–645 controls, 599–616, 622–625, 645–647 Windows Forms, 601–610 dependency properties, 648–656 event handlers, 625–626 Expression Blend, 617 hierarchy, 632 interfaces, 633–641 Label, 622 layout, 631–633 NET Framework, 617 resources, 640–641 Silverlight, 645 styles, 658–660 System.Windows.Forms, 627 target, 12 TextBox, 622 Toolbox, 645 UserControl, 647 Windows Forms, 541 controls, 601–614 Windows.Forms.Integration, 627 XAML, 255–258, 602–604, 617–666 1274 Windows Process Application Service (WAS), 981 Windows Server 2008, 982 Windows Server AppFabric, 883 Windows Services application services, 981–996 C11, 987 debugging, 988, 998–1000 errors, 988 FileWatcherService, 988–998 Installer, 985–986 NET Framework, 984–987 Server Explorer, 994 Service Control Manager, 982–984 ServiceBase, 984–985 ServiceController, 986, 994–996 ServiceInstaller, 985–986 ServiceProcessInstaller, 985–986 String, 998 uninstalling, 992 Windows Vista UAC, 1032 Windows Services, 982 Windows Workflow Foundation (WF), 14, 253, 881–903, 1165–1183 Activity library, 883 applications, 881–882 Custom activities, 883 customization, 896–899 dynamically loading, 899–900 Host process, 882 LINQ to XML, 891 Runtime services, 883 Workflow, 883 Workflow invoker, 883 WorkflowDesigner, 900–903 XAML, 882, 899–900, 1165 Windows XP, 982 WindowsBase, 604 WindowsDefaultBounds, 543 WindowsDefaultLocation, 543 Windows.Forms, 569–571 WindowsFormsHost, 601, 614 WindowsFormsIntegration, 604 Windows.Forms.Integration, 627 Windows.Forms.Integration.dll, 600–601 WindowStyle, 636 winform – Xmlreadersettings winForm, WinFormInteropCtrl, 614 /win32icon, 1142 /win32resource, 1142 With, 142 WithCancellation, 1098 WithDegreeOfParallelism, 1098 WithEvents, 44, 114 events, 116–117 threads, 117 WithExecutionMode, 1098 WithMergeOptions, 1098 WM_NCHITTEST, 962 WM_PAINT, 962 Word Actions Pane, 856–861 VSTO, 852–864 Word/Excel Trust Center, Macro Settings, 849 Workflow New Project, 14 SharePoint, 13 WF, 883 XAML, 262–264 workflows See also Windows Workflow Foundation flowchart, 883–884 sequential, 883, 1166 state machine, 1166–1167 Workflow invoker, WF, 883 WorkflowDesigner, 900–903 work-stealing queues, CLR, 1080 WPF See Windows Presentation Foundation wrapper classes, 491 Write Debug, 284 Shared Console, 11 StreamWriter, 283 WriteEntry, 282 WriteIf, 284 WriteLine Debug, 284 StreamWriter, 283 WF, 886, 887, 893, 894, 899 WriteLineIf, 284 WriteOnly, 111–112 WS-*, 514–515 WS-AtomicTransaction, 516 WS-Coordination, 516 WSDL, 491, 522–523 HelloCustomerService, 536–537 WSE See Web Service Enhancements WS-ReliableMessaging, 515 WS-SecureConversation, 515 WS-Security, 515 x x:, 258 X.509 certificates, 1046–1047 XAML See Extensible Application Markup Language XAMLpad, 255 xap, 682 x:Array, 261 XAttribute, 378 x:Class, 259 x:ClassModifier, 259 x:Code, 262 XCopy, 24, 1102 XDocument, 375 LINQ, 380–381 XElement, 375–376 x:FieldModifier, 260 x:Key, 260, 640–641 XML See Extensible Markup Language Xml, server control, 373–374 xml, 346 XML Path (XPath), 341 XmlAttribute, 359 XMLDataProvider, 662 XmlDataSource ASP.NET, 735 namespaces, 373 XmlDocument, 359 XmlElement, 359 XmlException, 269 XmlNameTable, 349 XmlNode, 359 XmlReader, 349, 469 exception handling, 358–359 stream-based XML documents, 351–359 XmlReaderSettings, 355–356 1275 Xmlresolver – Zoom button XmlResolver, 349, 365 XmlSerializer, 344–346 XmlWriter, 348, 349–351 x:Name, 260 XNamespace, 376–378 x:Null, 261 Xor, 130 XPath See XML Path x:Reference, 261 x:Shared, 260 XSL See Extensible Stylesheet Language xsl, 363 XSL Transformations (XSLT), 342, 360–369 HTML, 364–365 IDE, 363 Visual Studio, 363 XSLT See XSL Transformations XsltArgumentList, 369 1276 XsltCompileException, 369 XsltContext, 369 XsltException, 369 x:Static, 261 x:Subclass, 260 x:Type, 261 x:TypeArguments, 260 xUnit.net, 306 x:XData, 262 Z zero-impact deployment, 1008 zip, Geocode, 479 Zone, 1036 ZoneIdentityPermission, 1025 ZoneIdentityPermissionAttribute, 1025 Zoom button, 671 ... entities 42 6 42 8 42 8 42 9 42 9 42 9 43 0 43 1 43 2 43 3 43 5 43 7 43 8 43 8 43 9 44 2 44 3 44 3 44 5 44 6 Simple Mapping Using a Single Table for Multiple Objects Using Multiple Tables for an Object 44 6 44 8 45 0 Generating... Object 385 387 389 390 391 391 395 396 398 398 399 399 40 2 40 4 40 6 40 9 40 9 41 0 41 0 41 0 41 1 41 1 41 3 41 4 41 6 41 8 41 8 41 9 42 1 42 1 42 2 42 2 42 3 42 4 xxi conTenTs How objects Map to linQ objects The DataContext... T-SQL and Visual Basic Creating User-Defined Types Creating Stored Procedures Exposing Web Services from SQL Server SQL Server 2008 Features xxii 42 5 45 4 45 6 45 7 45 8 45 9 46 2 46 8 47 0 47 0 47 1 48 3 48 9