BN.com Gift Guide

Professional Visual Basic 2010 and .NET 4

Overview

Intermediate and advanced coverage of Visual Basic 2010 and .NET 4 for professional developers

If you've already covered the basics and want to dive deep into VB and .NET topics that professional programmers use most, this is your book. You'll find a quick review of introductory topics-always helpful-before the author team of experts moves you quickly into such topics as data access with ADO.NET, Language Integrated Query (LINQ), security, ...

See more details below
Other sellers (Paperback)
  • All (12) from $25.42   
  • New (9) from $25.42   
  • Used (3) from $32.95   

Overview

Intermediate and advanced coverage of Visual Basic 2010 and .NET 4 for professional developers

If you've already covered the basics and want to dive deep into VB and .NET topics that professional programmers use most, this is your book. You'll find a quick review of introductory topics-always helpful-before the author team of experts moves you quickly into such topics as data access with ADO.NET, Language Integrated Query (LINQ), security, ASP.NET web programming with Visual Basic, Windows workflow, threading, and more.

You'll explore all the new features of Visual Basic 2010 as well as all the essential functions that you need, including .NET features such as LINQ to SQL, LINQ to XML, WCF, and more. Plus, you'll examine exception handling and debugging, Visual Studio features, and ASP.NET web programming.

  • Expert author team helps you master the tools and techniques you need most for professional programming
  • Reviews why Visual Basic 2010 will be synonymous with writing code in Visual Studio 2010
  • Focuses on .NET features such as LINQ, LINQ to SQL, LINQ to XML, WPF, workflow, and more
  • Discusses exception handling and debugging, data access with ADO.NET, Visual Studio features for Visual Basic developers, Windows programming with Windows Forms, ASP.NET web programming with VB, communication interfaces, Windows workflow, and threading

This Wrox guide presents you with updated coverage on topics you need to know now.

Read More Show Less

Product Details

  • ISBN-13: 9780470502242
  • Publisher: Wiley
  • Publication date: 5/10/2010
  • Edition number: 1
  • Pages: 1320
  • Product dimensions: 7.40 (w) x 9.20 (h) x 1.90 (d)

Meet the Author

Bill Sheldon is a Microsoft MVP for Visual Basic and a Principal Engineer with InterKnowlogy.

Billy Hollis is MSDN Regional Director of Developer Relations for Microsoft in Nashville, Tennessee.

Kent Sharkey is an independent software consultant and former content strategist for MSDN.

Jonathan Marbutt is Vice President of Development for WayCool Software, Inc.

Rob Windsor is a Microsoft MVP and a Senior Consultant with ObjectSharp.

Gastón C. Hillar is an independent software consultant, specialized in parallelism and multicore.

Read More Show Less

Read an Excerpt

Professional Visual Basic 2010 and .NET 4


By Bill Sheldon Billy Hollis Kent Sharkey Gaston Hillar Rob Windsor Jonathan Marbutt

John Wiley & Sons

Copyright © 2010 John Wiley & Sons, Ltd
All right reserved.

ISBN: 978-0-470-50224-2


Chapter One

Visual Studio 2010

WHAT YOU WILL LEARN IN THIS CHAPTER

* Versions of Visual Studio * An introduction to key Visual Basic terms * Targeting a runtime environment * Creating a baseline Visual Basic Windows Form * Project templates * Project properties - application, compilation, debug * Setting properties * IntelliSense, code expansion, and code snippets * Debugging * Recording and using macros * The Class Designer * Team Foundation Server - Team Explorer

You can work with Visual Basic without Visual Studio. In fact, Appendix A focuses on using the Visual Basic compiler from the command line. In practice, however, most Visual Basic developers treat the two as almost inseparable; without a version of Visual Studio, you're forced to work from the command line to create project files by hand, to make calls to the associated compilers, and to manually address the tools necessary to build your application. While Visual Basic supports this at the same level as C#, F#, C++ and other .NET languages, this isn't the typical focus of a Visual Basic professional.

Visual Basic's success rose from its increased productivity in comparison to other languages when building business applications. Visual Studio 2010 increases your productivity and provides assistance in debugging your applications and is the natural tool for Visual Basic developers.

Accordingly, the current edition of this book is going to start off by introducing you to Visual Studio 2010 and how to build and manage Visual Basic applications. The focus of this chapter is on ensuring that everyone has a core set of knowledge related to tasks like creating and debugging applications in Visual Studio 2010. Visual Studio 2010 will be used throughout the book for building solutions. Note while this is the start, don't think of it as an 'intro' chapter. This chapter will intro key elements of working with Visual Studio, but will also go beyond that. You may find yourself referencing back to it later for advanced topics that you glossed over your first time through. Visual Studio is a powerful and, at times, complex tool and you aren't expected to master it on your first read through this chapter.

When Visual Studio 2005 was released, Microsoft expanded on the different versions of Visual Studio available for use. At the low-cost end, and currently free, is Visual Basic Express Edition. This tool enables you to build desktop applications with Visual Basic only. Its companion for Web development is Visual Web Developer Express, which enables you to build ASP.NET applications. At the high end, Microsoft offers Visual Studio Ultimate. Each of the high-end, Professional, Premium, and Ultimate editions is available as part of an MSDN subscription and each of these editions further extends the core Visual Studio 2010 capabilities beyond the core Integrated Development Environment (IDE) to help improve design, testing, and collaboration between developers.

Of course, the focus of this chapter is how Visual Studio enables you to use Visual Basic to build applications geared toward "better, faster, cheaper" business goals. To this end, we'll be examining features of Visual Studio starting with those in the core Visual Basic 2010 Express Edition and building up to the full Visual Studio Team Suite.

This chapter provides an overview of many of the capabilities of Visual Studio 2010. It also provides a brief introduction to the features available by using one of the more feature-rich versions of Visual Studio. Experienced developers will probably gloss over much of this information although I encourage them to review the new historical debugging features available in Visual Studio 2010 Ultimate covered in this chapter. The goal is to demonstrate how Visual Studio makes you, as a developer, more productive and successful.

VISUAL STUDIO 2010: EXPRESS THROUGH ULTIMATE

For those who aren't familiar with the main elements of .NET development there is the common language runtime (CLR), the .NET Framework, the various language compilers and Visual Studio. Each of these plays a role, for example the CLR - covered in Chapter 4 - manages the execution of code on the .NET platform. Thus code can be targeted to run on a specific version of this runtime environment.

The .NET Framework provides a series of classes that developers leverage across implementation languages. This framework or Class Library is versioned and targeted to run on a specific minimum version of the CLR. It is this library along with the language compilers that are referenced by Visual Studio. Visual Studio allows you to build applications that target one or more of the versions of what is generically called .NET.

In some cases the CLR and the .NET Framework will be the same; for example, .NET Framework version 1.0 ran on CLR version 1.0. In other cases just as Visual Basic's compiler is on version 10, the .NET Framework might have a newer version targeting an older version of the CLR.

The same concepts carry into Visual Studio. Visual Studio 2003 was focused on .NET 1.1, while the earlier Visual Studio .NET (2002) was focused on .NET 1.0. Originally, each version of Visual Studio was optimized for a particular version of .NET. Similarly, Visual Studio 2005 was optimized for .NET 2.0, but then along came the exception of the .NET Framework version 3.0. This introduced a new Framework, which was supported by the same version 2.0 of the CLR, but which didn't ship with a new version of Visual Studio.

Fortunately, Microsoft chose to keep Visual Basic and ASP.NET unchanged for the .NET 3.0 Framework release. However, when you looked at the.NET 3.0 Framework elements, such as Windows Presentation Foundation, Windows Communication Foundation, and Windows Workflow Foundation, you found that those items needed to be addressed outside of Visual Studio. Thus, while Visual Studio is separate from Visual Basic, the CLR and .NET development, in practical terms Visual Studio was tightly coupled to each of these items.

With Visual Studio 2008, Microsoft loosened this coupling by providing robust support that allowed the developer to target any of three different versions of the .NET Framework. Visual Studio 2010 continues this, enabling you to target an application to run on .NET 2.0, .NET 3.0,.NET 3.5, or .NET 4.

However, as you'll discover, this support doesn't mean that Visual Studio 2010 isn't tightly coupled to a specific version of each compiler. In fact, the new support for targeting frameworks is designed to support a runtime environment, not a compile-time environment. This is important because when projects from previous versions of Visual Studio are converted to the Visual Studio 2010 format, they cannot be reopened by a previous version.

The reason for this is that the underlying build engine used by Visual Studio 2010 accepts syntax changes and even language feature changes, but previous versions of Visual Studio do not recognize these new elements of the language. Thus, if you move source code written in Visual Studio 2010 to a previous version of Visual Studio, you face a strong possibility that it would fail to compile. There are ways to manually work with a project across versions of Visual Studio on the same team, but they are not supported. Bill Sheldon, one of the authors of this book, has a blog post from August 2007 that deals with his experience doing this in Visual Studio 2008. The post titled "Working with Both VS 2005 and VS 2008 B2 on the Same Project" is still applicable for those working with Visual Studio 2010: http://nerdnotes .net/blog/default,date,2007-08-29.aspx.

Multi-targeting support by Visual Studio 2010 ensures that your application will run on a specific version of the framework. Thus, if your organization is not supporting .NET 3.0, .NET 3.5, or .NET 4, you can still use Visual Studio 2010. The compiler generates byte code based on the language syntax, and at its core that byte code is version agnostic. Where you can get in trouble is if you reference one or more classes that aren't part of a given version of the CLR. Visual Studio therefore manages your references when targeting an older version of .NET allowing you to be reasonably certain that your application will not reference files from one of those other framework versions. Multi-targeting is what enables you to safely deploy without requiring your customers to download additional framework components they don't need.

With those ground rules in place, what versions of Visual Studio 2010 are available, and what are the primary differences between them? As already mentioned, Visual Basic 2010 Express is at the bottom tier in terms of price and features. It is accompanied there by Visual Web Developer 2010 Express Edition, for those developers who are developing Web applications, rather than desktop applications. These two tools are separate, but both support developing different types of Visual Basic applications, and both are free. Note, however, that neither is extensible; these tools are meant to be introductory, and Microsoft's license prevents vendors from extending these tools with productivity enhancements.

However, each of the Express Edition development tools also ships with two additional components covered briefly here: MSDN Express Edition and SQL Server 2008 Express Edition. MSDN is, of course, the Microsoft Developer Network, which has placed most of its content online. It's the source for not only the core language documentation for Visual Basic, but also articles on almost every product oriented to developers using Microsoft technology. Full versions of Visual Studio ship with the full MSDN library so that you can access its content locally. However, the Express Edition tools actually ship with a pared-down set of documentation files.

Similar to the language and Web-based tools, Microsoft has a SQL Server Express Edition package. This package has a history, in that it replaces the MSDE database engine that was available with SQL Server 2000. The SQL Server Express engine provides the core SQL Server 2008 database engine. For more information on SQL Server Express go to www.microsoft.com/express/database. Note that a free database management application is available via a separate download from Microsoft.

When you install Visual Studio 2010, including the Express Editions, you also have the opportunity to install this core database engine. The elements of this engine are freely redistributable, so if you are looking for a set of core database features based on ADO.NET, you can create your application and deploy your SQL Server 2008 Express Edition database without being concerned about licensing.

Getting back to the differences in versions, the Express Edition tools provide the core components necessary to create Visual Basic applications (Windows or Web) based on the core IDE. Table 1-1 provides a quick summary of what versions are available, including a description of how each extends Visual Studio.

The Express Edition tools are best described as targeting students and hobbyists, not because you can't create serious applications but because they provide only limited support for team development, have limited extensibility, and offer a standalone environment. The Express Tools are oriented toward developers who work independently, while still providing full access to features of the Visual Basic language. This chapter begins working in the IDE using features available in this version, which is essentially the lowest common denominator, and then goes beyond the capabilities of this free tool.

Eventually, however, a developer needs additional tools and projects. This is where the full versions of Visual Studio 2010 (Standard, Professional, Premium and Ultimate) come in. With an increasing level of support for team development, these feature-rich versions add macro support, and, more important, an Object Modeling tool. As discussed in the section titled "Class Diagrams," later in this chapter, Visual Studio enables you to create a visual representation of the classes in your solution and then convert that representation into code. Moreover, the tool supports what is known as round-trip engineering. This means that not only can you use the graphical model to generate code, you can also take a project's source files and regenerate an updated version of the graphical model - that is, edit that model in its graphical format and then update the associated source files.

For those choosing Visual Studio 2008 Professional or above, Visual Studio Tools for Office (VSTO) is targeted primarily at enterprise developers, those who work in corporate organizations (either as employees or consultant/contractors). This tool provides a way for users of the enterprise editions of Microsoft Office 2007 and Microsoft Office 2010 to extend these office productivity tools with application-like features. Many organizations use Microsoft Office for tasks that border on custom applications. This is especially true for Microsoft Excel. VSTO provides project templates based on these Microsoft Office products that enable, for example, a spreadsheet to retrieve its contents from an SQL Server database instead of the local file system. These tools provide the capability not only to manipulate data retrieval and saving, but also to customize the user interface, including direct access to the task pane and custom toolbar options within Microsoft Office products; they are covered in more detail in Chapter 25.

Visual Studio 2010 Premium and Ultimate focus on extending a developer's reach beyond just writing code. These tools are used to examine code for flaws, manage the deployment environment, and define relationships between applications. The high-end versions are focused on tools that support repeatable software processes and best practices. They are geared toward examining source code for hidden flaws that might not cause the code to fail, but might hide a hidden security flaw or make it difficult to maintain or deploy the application. More important, the suite includes tools for creating unit test tools that attempt to cause the code to fail, whether through bad input data or heavy load.

Complete coverage of all of Visual Studio Ultimate's features warrants a book of its own, especially when you take into account all of the collaborative features introduced by Team Foundation Server and its tight integration with both Team Build and SharePoint Server. Team Foundation Server goes beyond just being a replacement for Visual Source Safe. It is the basis for true process-driven development, and it even includes documentation to help train your organization on two process models supported by Microsoft.

VISUAL BASIC KEYWORDS AND SYNTAX

Those with previous experience with Visual Basic are already familiar with many of the language keywords and syntax. However, not all readers will fall into this category so this introductory section is for those new to Visual Basic. A glossary of keywords is provided after which this section will use many of these keywords in context.

Although they're not the focus of the chapter, with so many keywords, a glossary follows. Table 1-2 briefly summarizes most of the keywords discussed in the preceding section, and provides a short description of their meaning in Visual Basic. Keep in mind there are two commonly used terms that aren't Visual Basic keywords that you will read repeatedly including in the glossary:

* Method - A generic name for a named set of commands. In Visual Basic, both subs and functions are types of methods. * Instance - When a class is created, the resulting object is an instance of the class's definition.

Even though the focus of this chapter is on Visual Studio, during this introduction a few basic elements of Visual Basic will be referenced and need to be spelled out. This way as you read, you can understand the examples. Chapter 4, for instance, covers working with namespaces, but some examples and other code are introduced in this chapter that will mention the term, so it is defined here.

Let's begin with namespace. When .NET was being created, the developers realized that attempting to organize all of these classes required a system. A namespace is an arbitrary system that the .NET developers used to group classes containing common functionality. A namespace can have multiple levels of grouping, each separated by a period (.). Thus, the System namespace is the basis for classes that are used throughout .NET, while the Microsoft.VisualBasic namespace is used for classes in the underlying .NET Framework but specific to Visual Basic. At its most basic level, a namespace does not imply or indicate anything regarding the relationships between the class implementations in that namespace; it is just a way of managing the complexity of both your custom application's classes, whether it be a small or large collection, and that of the .NET Framework's thousands of classes. As noted earlier, namespaces are covered in detail in Chapter 4.

(Continues...)



Excerpted from Professional Visual Basic 2010 and .NET 4 by Bill Sheldon Billy Hollis Kent Sharkey Gaston Hillar Rob Windsor Jonathan Marbutt Copyright © 2010 by John Wiley & Sons, Ltd. Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Table of Contents

INTRODUCTION.

CHAPTER 1 Visual Studio 2010.

CHAPTER 2 Objects and Visual Basic.

CHAPTER 3 Custom Objects.

CHAPTER 4 The common language runtime.

CHAPTER 5 Declarative Programming with Visual Basic.

CHAPTER 6 Exception Handling and Debugging.

CHAPTER 7 Test-Driven Development.

CHAPTER 8 Arrays, Collections, and Generics.

CHAPTER 9 Using XML with Visual Basic.

CHAPTER 10 ADO.NET and LINQ.

CHAPTER 11 Data Access with the Entity Framework.

CHAPTER 12 Working with SQL Server.

CHAPTER 13 Services (XML/WCF).

CHAPTER 14 Windows Forms.

CHAPTER 15 Advanced Windows Forms.

CHAPTER 16 User Controls Combining WPF and Windows Forms.

CHAPTER 17 WPF Desktop Applications.

CHAPTER 18 Expression Blend 3.

CHAPTER 19 Silverlight.

CHAPTER 20 Silverlight and Services.

CHAPTER 21 Working with ASP.NET.

CHAPTER 22 ASP.NET Advanced Features.

CHAPTER 23 ASP.NET MVC.

CHAPTER 24 SharePoint 2010 Development.

CHAPTER 25 Visual Studio Tools for Office.

CHAPTER 26 Windows Workflow Foundation.

CHAPTER 27 Localization.

CHAPTER 28 COM-Interop.

CHAPTER 29 Network Programming.

CHAPTER 30 Application Services.

CHAPTER 31 Assemblies and Reflection.

CHAPTER 32 Security in the .NET Framework.

CHAPTER 33 Parallel Programming Using Tasks and Threads.

CHAPTER 34 Deployment.

APPENDIX A: The Visual Basic Compiler.

APPENDIX B: Visual Basic Power Packs Tools.

APPENDIX C: Workfl ow 2008 Specifics.

APPENDIX D: Enterprise Services.

APPENDIX E: Programming for the Cloud.

INDEX .

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)