.NET is designed to provide a new environment within which you can develop almost any application to run on Windows (and possibly in the future on other platforms). Visual Basic .NET (VB.NET) is likely to be a very popular development tool for use with this framework. VB.NET is a .NET compliant language and as such has (except for legacy reasons) almost identical technical functionality as the new C# language and Managed Extensions for C++. Using VB.NET, a dynamic Web page, a component of a distributed application, a database access component, or a classic Windows desktop application can be developed.
In order to incorporate Visual Basic into the .NET Framework, a number of new features have been added to it. In fact, the changes are so extensive that VB.NET should be viewed as a new language rather than simply as Visual Basic 7. However, these changes were necessary to give developers the features that they have been asking for: true object orientated programming, easier deployment, better interoperability, and a cohesive environment in which to develop applications.
In this book, we cover VB.NET virtually from start to finish: we begin by looking at the .NET Framework, and end by looking at best practices for deploying .NET applications. In between, we look at everything from database access to integration with other technologies such as XML, along with investigating the new features in detail. You will see that VB.NET has emerged as a powerful yet easy to use language that will allow you to target the Internet just as easily as the desktop.
What do you need to use this book?
Although it is possible to create VB.NET applications using the command lines tools contained in the .NET Framework SDK, you will need Visual Studio .NET (Professional or higher), which includes the .NET Framework SDK, to use this book to the full.
Some chapters make use of SQL Server 2000. However, you can also run the example code using MSDE (Microsoft Data Engine), which ships with Visual Studio .NET.
Several chapters make use of Internet Information Services (IIS). IIS ships with Windows 2000 Server, Windows 2000 Professional, and Windows XP, although it is not installed by default.
Chapter 18 makes use of MSMQ to work with queued transactions. MSMQ ships with Windows 2000 Server, Windows 2000 Professional, and Windows XP, although it is not installed by default.
Who is this book for?
This book is aimed at experienced Visual Basic developers who want to make the transition to VB.NET.
What does this book cover?
This book explains the underlying philosophy and design of the .NET Framework and Common Language Runtime (CLR) and explains the differences between Visual Basic 6 and Visual Basic .NET.
You will learn how to:
Develop applications and components using Visual Studio .NET
Effectively apply inheritance and interfaces when designing objects and components
Organize your code using namespaces
Handle errors using the Try...Catch...Finally structure
Access data using ADO.NET and bind controls to the underlying data sources
Create Windows applications and custom Windows controls
Interoperate with COM and ActiveX components
Create transactional and queuing components
Use .NET Remoting to send serialized objects between clients and servers
Create Windows Services
Use VB.NET to access information on the Web
Create and consume Web Services
Secure your applications and code using the tools provided in the .NET Framework SDK
Arrange your applications and libraries in assemblies and deploy them using Visual Studio .NET
Chapter 1, Why do we need Microsoft .NET? ·This chapter explains the importance of .NET, and just how much it changes application development. We look at how .NET corrects the drawbacks by using the Common Language Runtime (CLR).
Chapter 2, A First Look at VB.NET ·This chapter provides our first look at a Visual Basic .NET application. As we develop this application we'll take a tour of some of the new features of Visual Studio .NET.
Chapter 3, The Common Language Runtime ·This chapter examines the core of the .NET platform, the Common Language Runtime (CLR). The CLR is responsible for managing the execution of code compiled for the .NET platform. We cover versioning and deployment, memory management, cross-language integration, metadata, and the IL Disassembler.
Chapter 4, Variables and Data Types ·This chapter introduces many of the types commonly used in Visual Basic .NET.
Chapter 5, Object Syntax Introduction ·This is the first of three chapters that explores object-orientated programming in VB.NET. This chapter will define objects, classes, instances, encapsulation, abstraction, polymorphism, and inheritance.
Chapter 6, Inheritance and Interfaces ·This chapter examines inheritance and how it can be used within VB.NET. We create simple and abstract base classes, and understand how to create base classes from which other classes can be derived.
Chapter 7, Applying Objects and Components ·This chapter puts the theory of Chapters 5 and 6 into practice. The four defining object-oriented concepts (abstraction, encapsulation, polymorphism, inheritance) are explained, and we explain how these concepts can be applied in design and development to create effective object-oriented applications.
Chapter 8, Namespaces ·This chapter introduces namespaces and their hierarchical structure. An explanation of namespaces and some common ones are given. In addition, we understand how to create new namespaces, and how to import and alias existing namespaces within projects.
Chapter 9, Error Handling ·This chapter covers how error handling works in VB.NET by discussing the CLR exception handler and the new Try·atch·inally structure. We also look at error handling between managed and unmanaged code, error and trace logging, and how we can use these methods to obtain feedback on how our program is working.
Chapter 10, Using XML in VB.NET ·This chapter presents the features of the .NET Framework that facilitate the generation and manipulation of XML. We describe the .NET Framework's XML related namespaces and a subset of the classes exposed by these namespaces are examined in detail. This chapter also touches on a set of technologies that utilize XML, specifically ADO.NET and SQL Server.
Chapter 11, Data Access with ADO.NET ·This chapter focuses on what you will need to know about the ADO.NET object model in order to be able to build flexible, fast, and scalable data access objects and applications. The evolution of ADO into ADO.NET is explored and the main objects in ADO.NET that you need to understand in order to build data access into your .NET applications are explained.
Chapter 12, Windows Forms ·This chapter looks at Windows Forms, concentrating primarily on forms and built-in controls. What is new and what has been changed from previous versions of Visual Basic is discussed, along with the System.Windows.Forms namespace.
Chapter 13, Creating Windows Controls ·This chapter looks at creating our own Windows controls. In particular, we discuss how to inherit from another control, build a composite control, and write controls from scratch based on the Control class.
Chapter 14, Web Forms ·This chapter explores Web Forms and how you can benefit from their use. Using progressively more complex examples, this chapter explains how .NET provides the power of Rapid Application Development (normally associated with Windows applications) for the development of Web applications.
Chapter 15, Creating Web Controls ·This chapter looks at an entirely new form of Visual Basic control development: custom Web controls. It looks at the various forms of custom Web control development that are available in the .NET Framework. The basic structure of web user and sub-classed controls is examined, along with a look at composite and templated controls.
Chapter 16, Data Binding ·This chapter examines how data binding in .NET makes the process of associating an underlying data store with controls easier than in previous versions of Visual Basic. We look at how .NET allows the automatic population of controls with data from an underlying data source and also provides a mechanism for updating the underlying data source in response to any changes the user may make within Windows applications.
Chapter 17, Working with Classic COM and Interfaces ·This chapters discusses COM and .NET component interoperability, and what tools are provided to help link the two technologies together.
Chapter 18, Component Services ·This chapter explores the .NET Component Services, in particular, transaction processing, and queued components.
Chapter 19, Threading ·This chapter explores threading and explains how the various objects in the .NET Framework enable any consumer of it to develop multithreaded applications. We examine how threads can be created, how they relate to processes, and the differences between multitasking and multithreading.
Chapter 20, Remoting ·This chapter takes a detailed look at how to use remoting in classic 3-tier application design.
Chapter 21, Windows Services ·This chapter examines how VB.NET is used in the production of Windows Services. The creation, installation, running, and debugging of Windows Services is covered.
Chapter 22, Web Services ·This chapter looks at how to create and consume Web Services using VB.NET. The abstract classes provided by the CLR to set up and work with Web Services are discussed, as well as some of the technologies that support Web Services. Finally, some of the disadvantages to using any distributed architecture and the future with Web Services are examined.
Chapter 23, VB.NET and the Internet ·This chapter looks at how to download resources from the Web, how to design our own communication protocols, and how to reuse the WebBrowser control in our applications.
Chapter 24, Security in the .NET Framework ·This chapter examines the additional tools and functionality with regards to security provided by .NET. Caspol.Exe and Permview.exe, which assist in establishing and maintaining security policies, are discussed. The System.Security.Permissions namespace is looked at and we discuss how it relates to managing permissions. Finally, we examine the System.Security.Crytography namespace, and run through some code to demonstrate the capabilities of this namespace.
Chapter 25, Assemblies and Deployment ·This chapter examines assemblies and their use within the CLR. The structure of an assembly, what it contains, and the information it contains is examined. In addition, the manifest of the assembly and its role in deployment will be looked at. We also look at what Visual Studio .NET and the CLR have to offer us when we come to deploy our applications.
Appendix A, Using the Visual Basic Compatibility Library ·This appendix looks at the Visual Basic Compatibility Library, which is provided in order to assist in the conversion of VB6 code.