BOOK REVIEW

Visual C# .NET: A Guide for VB6 Developers

Wrox Press

Brad Maiani, James Still, Angelo Kastroulis, Marco Bellinaso, Cristian Darie

ISBN: 1-86100-717-5

 

Category

Rating

LEGEND:

5=Excellent

4=Good

3=Standard

2=Fair

1=Poor

 

Overall recommendation

5

Quality of organization

4

Easy to read and navigate

3

Sufficient quantity of examples

5

Examples are error free

5

Reuse for reference

5

Quality of index

4

 

Summary Review 

 This book provides an excellent introduction to C# and .NET for Visual Basic 6 developers.  Having programmed in VC++ rather than VB for the past few years, I still rate the book highly for anyone interested in getting a grounding in .NET.

Detailed Comments 

 Chapter 1 provides a nice overview of the .NET Framework, as well as an overview of the C# language, contrasting it with VB6 and VB.NET.  The authors do a good job of explaining why a VB6 programmer should be interested in switching to C#.  They also provide a very good introduction to Visual Studio.NET.

 

Chapter 2 skips the usual discussion of console applications and takes the VB programmer directly to Visual Studio .NET.  Here the authors create a simple Windows Form contrasting the differences between Visual Studio.NET and Visual Studio 6.0 in constructing the form.  The form provides a user interface for a number guessing game.  As the authors develop the code they explain the syntactical differences between C# and Visual Basic 6.  Overall, the chapter provides a solid introduction to C# and .NET for a Visual Basic developer.

 

Chapter 3 reinforces the new concepts introduced in chapter 2.  This time the vehicle is another game.  This example uses a variety of C# constructs, and once again contrasts them with VB.  By now, the VB6 programmer should have a good foundation in the syntax of C#.

 

Chapters 4 and 5 assume the reader has had little experience in Object Oriented Programming.  Chapter 4 introduces the VB programmer to objects and classes, inheritance, polymorphism, overloaded methods, and constructors using console applications with WriteLine statements to illustrate these concepts.  Chapter 5 continues the same theme, this time introducing more object oriented concepts such as method and property hiding and overriding, static members and constructors, interfaces and interface inheritance, value types and reference types, passing types by value and by reference.  Finally chapter 5 presents the System.Object and the methods that are available to all C# objects (Equals, ReferenceEquals, GetHashCode, GetType and ToString).  Together, these two chapters provide the VB programmer with a solid foundation for Object Oriented Programming.

 

Chapter 6 begins a four chapter exercise in building a Windows application.  This is an application that assists a book review manager with several tasks involved in coordinating book reviews.  By now, the reader is taken away from any equivalent in VB6 and is focusing on .NET design, construction and test.  In building this application, the reader learns how to use many of the objects available to the .NET developer.  The exercised begins by adding a Tab Control to the new empty Form, and adding a TabPage for each of four tasks.  The rest of Chapter 6 involves adding features, such as Menus, a Context Menu, Dialogs, Message Boxes, a TreeView, GroupBoxes, Buttons, Labels, a ComboBox, a DateTimePicker, and a RichTextBox to the first TabPage (Manage Reviews).  The authors take time to explain important sections of the code.

 

Chapter 7 continues to build on the example started in Chapter 6 by showing  how existing COMs can be used in .NET.  Internet Explorer and MSMAPI were used to illustrate this feature.  This chapter also shows off C# capability to manipulate strings.

 

Continuing the example into Chapter 8, we are introduced to developing Custom Controls.  First we created LabeledTextBox, a control that combines a TextBox with its associated label.  Then we created CustomFilter1, a control that produces a string used for filtering data (a SQL query).  Finally, we created ValidateTextBox.  This control inherits from the TextBox control, rather than from UserControl as the two previous controls.  The ValidateTextBox control allowes us to specify some crieteria to validate values entered into the TextBox.  It illustrates the Visual Studio .NET capability to use Custom Control features at design time, prompting us with members and parameters of our custom control just like any standard control from the Tools pallet.

 

In Chapter 9 we continue to build on our ReviewManager example.  We are introduced to ADO.NET and learn how to use the Data Adaptor Configuration Wizard , a DataSet control, and a DataGrid to present data from the pubs database in a DataGrid on our form.  We learn how bind the DataSet control to the database, and that the DataSet control is a disconnected snapshot from the database.  Finally, we learn how to add functions that reflect our changes back into the database.  What we have created is a "fat" client, 2-tier application tighly coupled to the database.  We have to wait until Chapters 12 and 13 to learn how to build n-tier scaleable applications.

 

Chapter 10 begins with a discussion of the differences between 2-tier, Client/Server applications, and n-tier applications.  It remindes the VB6 programmer of how they may have used COM components (ActiveX DLL) as a middle tier in applications they have created.  Finally, this chapter creates a new example using a simple Windows Form for the Data-Presentation tier, and creates a C# Class Library that functions as a Data-Access tier. The Data-Access tier reads a Comma Separated Value (CSV) file, and passes the data to the Windows Form which displays the data in a Picture Box and on Labels of  the form

 

Chapter 11 deals with interoperability (interop).  First the authors reveal some of the complexities of COM that VB had hidden from them.  Next they contrast a .NET Assembly with a COM and show how the Assembly avoids "dll hell".  They explain the difference between a private assemblies and shared assemblies, and introduce the Global Assembly Cache (GAC).  After laying a theoretical foundation, we are lead to create a COM object using VB6.  Next we a build a C# Windows Form to make use of this COM.  By adding a reference to the COM to the Windows Form in Visual Studio .NET, C# creates a Runtime Callable Wrapper (RCW) for the COM object making it usable by the Windows Form.  Next we are introduced to the inverse process, using C# code from VB6.  This time we create a C# utility class and sign the assembly with a strong name.  We learn that in order to use a .NET assembly from VB we will need to register the assembly using a .NET utility called regasm.exe.  Finally we build a VB6 client that can use the .NET assembly, thus learning two way interop.

 

Chapter 12 begins a two chapter section delving further into the features of ADO.NET.  First the authors discuss Data Providers, explaining the advantages of SqlClient as opposed to OleDb.  Then they spend some time on the DataAdapter, described as a "bridge" between the data source and the client side.  They provide some guidelines on managing connections.  Next the authors discuss the SqlCommand object.  They contrast the use of SQL statements in the code vs the use of stored procedures in SqlCommands.  Finally they address SqlDataReaders and DataSets, showing where the use of each is appropriate.

 

Chapter 13 completes the information on ADO.NET.  This chapter discusses concurrency issues, and explores the rich concurrency support provided by ADO.NET.  Next, the authors present a small example to illustrate the tight coupling between XML and ADO.NET.  They provide a link to a website where the reader can learn more about XML stylesheets.  Finally, they present  a simple 3-tier distributed application to illustrate the design principles involved in this type of application.  Recognizing that the material presented here only scratches the surface of ADO.NET, they recommend a few books that go into detail on the subject.  They also provide links to related information about ASO.NET on MSDN.

 

Chapter 14 provides a fitting conclusion to the book by showing us how to deploy our applications.  You may be able to deploy your application with a simple XCOPY, but Visual Studio.NET provides powerful tools to create a Setup program.  The authors provide a through disscussion of the Setup tools, and remind us that we must insure that the .NET runtime is installed on the target computer.

 

 

Reviewer:

Jack Donahoe

Date:

9/17/ 2002