Apress

Pro VB 2010 and the .NET 4.0 Platform

By Andrew Troelsen , Vidya Vrat Agarwal

Pro VB 2010 and the .NET 4.0 Platform Cover Image

Be the first to understand .NET 4.0 and Visual Basic 2010. Pro VB 2010 and the .NET 4.0 Platform provides developers with a complete guide to the new technology, explaining the importance of all the key VB 2010 language features.

Full Description

  • ISBN13: 978-1-4302-2985-8
  • 1800 Pages
  • User Level: Intermediate to Advanced
  • Publication Date: October 18, 2010
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $59.99
  • eBook Price: $41.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Be the first to understand .NET 4.0 and Visual Basic 2010. Pro VB 2010 and the .NET 4.0 Platform provides developers with a complete guide to the new technology, explaining the importance of all the key VB 2010 language features. This edition has been comprehensively revised and rewritten to make it accurately reflect the VB 10 language specification for the .NET 4.0 platform. You’ll find new chapters covering the important concepts of dynamic lookups, named and optional arguments, Parallel LINQ (PLINQ), improved COM interop, and variance for generics.

The first edition of this book was released at the 2001 Tech-Ed conference in Atlanta, Georgia. At that time, the .NET platform was still a beta product, and in many ways, so was this book. This is not to say that the early editions of this text did not have merit—after all, the book was a 2002 Jolt Award finalist and it won the 2003 Referenceware Excellence Award. However, over the years that author Andrew Troelsen spent working with the common language runtime (CLR), he gained a much deeper understanding of the .NET platform and the subtleties of the VB programming language, and he feels that this sixth edition of the book is as close to a “final release” as he’s come yet!

If you’re checking out this book for the first time, do understand that it’s targeted at experienced software professionals and/or graduate students of computer science (so don’t expect three chapters on iteration or decision constructs!). The mission of this text is to provide you with a rock-solid foundation in the VB programming language and the core aspects of the .NET platform (assemblies, remoting, Windows Forms, Web Forms, ADO.NET, XML web services, etc.). Once you digest the information presented in these 25 chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments and explore the .NET universe on your own terms.

What you’ll learn

  • Discover the ins and outs of the leading .NET technology.
  • Learn from an award-winning author who has been teaching the .NET world since version 1.0.
  • Find complete coverage of the WPF, WCF, and WF foundations that support the core .NET platform.

Who this book is for

This book is for anyone with some software development experience who is interested in the new .NET Framework 4.0 and the VB language. Whether you are moving to .NET for the first time or are already writing applications on .NET 2.0 or .NET 3.5, this book will provide you with a comprehensive grounding in the new technology and serve as a complete reference throughout your coding career.

Table of Contents

Table of Contents

  1. Introducing VB 2010
  2. Building Visual Basic 2010 Applications
  3. Core VB 2010 Programming Constructs, Part I
  4. Core VB 2010 Programming Constructs, Part II
  5. Defining Encapsulated Class Types
  6. Understanding Inheritance and Polymorphism
  7. Understanding Structured Exception Handling
  8. Understanding Object Lifetime
  9. Working with Interfaces
  10. Understanding Generics
  11. Delegates, Events, and Lambdas
  12. Advanced VB 2010 Language Features
  13. LINQ to Objects
  14. Configuring .NET Assemblies
  15. Type Reflection, Late Binding, and Attribute-Based Programming
  16. Processes, AppDomains, and Object Contexts
  17. Understanding CIL and the Role of Dynamic Assemblies
  18. Dynamic Types and the Dynamic Language Runtime
  19. Multithreaded and Parallel Programming
  20. File I/O and Object Serialization
  21. ADO.NET Part I: The Connected Layer
  22. ADO.NET Part II: The Disconnected Layer
  23. ADO.NET Part III: The Entity Framework
  24. Introducing LINQ to XML
  25. Introducing Windows Communication Foundation
  26. Introducing Windows Workflow Foundation 4.0
  27. Introducing Windows Presentation Foundation and XAML
  28. Programming with WPF Controls
  29. WPF Graphics Rendering Services
  30. WPF Resources, Animations, and Styles
  31. WPF Control Templates and UserControls
  32. Building ASP.NET Web Pages
  33. ASP.NET Web Controls, Master Pages, and Themes
  34. ASP.NET State Management Techniques
  35. Programming with Windows Forms
  36. Platform-Independent .NET Development with Mono
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

If you think that you've found an error in this book, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

* Required Fields

On page 41 and 42:
dotNetFx40_full_setup.exe does not install ".NET Framework 4.0 SDK".

Additional; also installing "Visual Studio 2010 Express" does not install ".NET Framework 4.0 SDK"

There will not be created a "Visual Studio Tools folder" to access the .NET Framework SDK in the Start menu under "Microsoft Visual Studio 2010" folder.

The whole SDK article should be corrected:

You have to download the "Windows SDK 7.1" (winsdk_web.exe) to make get the .NET Framework 4.0 SDK from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8279

After that you access the SDK via start menu > Microsoft Windows SDK v7.1 folder en then run "Windows SDK 7.1 Command Prompt"

On page 47:
Example code block "Module TestApp" contains line:
Dim h As New HelloMsg()

This is wrong and should be:
Dim h As New HelloMessage()

Since it is the Class being called (initiated) and not the File HelloMsg.vb containing the Class HelloMessage()

On page 47:
Imports System.Windows. Forms
Public Class HelloMessage()
Public Sub Speak()
MessageBox.Show("Hello...')
End Sub
End Class

Module TestApp
Sub Main()
Console.Writeline("Testing 1,2,3")
Dim h as New HelloMsg()
h.Speak()
End Sub
End Module

Shouldn't the call be
dim h as New HelloMessage() ?

On page 60 - 61:
There seem to be two errors.

1) The example code includes both VB and C# methods.
2) The refactor instructions (cut and paste) don't work. In fact, refactoring doesn't appear to be an option at all for VB (though it is an option for C#).

I've Googled the subject, and there seems to be agreement that Microsoft did not include refactoring support for VB. There does seem to be some 3rd party support, though I haven't tried any.

On page 129:
' Output parameters must be assigned by the called method.
Shared Sub Add(ByVal x As Integer, ByVal y As Integer, < Out()>
ByRef ans As Integer)
ans = x + y
End Sub

"Shared" is invalid syntax, should this be "Public" ??

On page 130:
Sub ThisWontCompile(<Out()> ByRef a As Integer)
Console.WriteLine("Error! Forgot to assign output arg!")
End Sub

this does compile. Using vs2010 express ??
so statement "Finally, always remember that a method that defines output parameters must assign the parameter
to a valid value before exiting the method scope." is incorrect

On page 135:
DisplayFancyMessage(backgroundColor!= ConsoleColor.Green)

should be

DisplayFancyMessage(backgroundColor:= ConsoleColor.Green)

On page 185:
Code will not compile on :
Return messages(GetRandomNumber(5))

error: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class

On page 185:
top of page:
The function GetRandomNumber() should be shared

On page 192:
'This is just fine.
TimeUtilModule PrintDate()
TimeUtilModule PrintTime()

should be

'This is just fine.
TimeUtilModule.PrintDate()
TimeUtilModule.PrintTime()

On page 212:
'Shared constructors are used to initialize Shared data.
Public Class Employee
Private Shared comapanyName As String
Shared Sub New()
companyName = "Intertech Training"
End Sub
End Class

3rd line should be companyName

On page 268:
If TypeOf obj Is Person AndAlso obj <> Nothing Then

should be -:

If TypeOf obj Is Person AndAlso not obj is Nothing Then

On page 422:
'Compiler error! Method does not match delegate pattern!
Dim b As New BinaryOp(AddressOf SimpleMath.Add)

should read

'Compiler error! Method does not match delegate pattern!
Dim b As New BinaryOp(AddressOf SimpleMath.SquareNumber)

On page 490:

Chapter 12 page 490 the example code for the 'ERROR' and 'OK!' versions are identical. I think the non-working example should be trying to access Speed without the c. ?

On page 532:

The corrected sample code at the top of the page is the same as the non working code preceding it. it should say return nameDesc.ToArray()