Introducing Visual Basic 2005 for Developers

Peter Kitson

ISBN : 073562058X

Order a printed copy of this book from Amazon.


Cover Design - Introducing Visual Basic 2005 for Developers
 

For your free electronic copy of this book please verify the numbers below. 

(We need to do this to make sure you're a person and not a malicious script)

Numbers

 




Sample Chapter From Introducing Visual Basic 2005 for Developers
     Copyright © Kris Horrocks, Sean Campbell, Derek Hatchard, Peter Bernhardt, Scott Swigart



Chapter 1 -  Microsoft .NET Framework Primer for the Visual Basic Developer


The Microsoft .NET Framework and the corresponding versions of Microsoft Visual Studio that target the .NET Framework are major innovations for software developers. If you have been programming in Visual Basic 6 (or earlier), you will appreciate the advances in productivity, security, reliability, and “deployability” offered by these new development and execution environments.


Every program relies on its platform and other libraries to provide run-time services. Visual Basic 6 programmers know well the types of services provided by the Visual Basic Runtime. Java programmers use the Java Virtual Machine (JVM). Other programmers use the libraries for the technologies they develop with. The Microsoft .NET Framework class library provides a rich library for creating applications that run on the platform (or execution environment) known as the common language runtime (CLR). This chapter will introduce you to the basics of the .NET Framework, its class library, and the developer tools that make up Microsoft Visual Studio 2005. At the end of this chapter are some highlights of the new features in .NET Framework 2.0 and Visual Studio 2005 that are covered in more detail in the rest of this book.


The .NET Framework CLR is an execution environment that manages key platform services, including memory and security. Code that targets the .NET Framework is often referred to as managed code because it requires management services provided by the execution environment. All Visual Basic code you write for the .NET Framework is managed code. This includes Windows applications, Web applications, and all other types of applications.


The Applications You Can Build

You have probably heard a lot of hype about .NET and XML Web services. Much of that hype is well deserved because the .NET Framework and Visual Studio 2005 make building and consuming Web services so easy. But Microsoft .NET technologies are not just about Web services. Visual Studio 2005 and the .NET Framework are just as powerful for creating other types of applications including Windows and Web applications. At times, the hype around Web services has overshadowed the wide range of applications you can create with Microsoft .NET technologies and the many benefits of targeting the .NET Framework, including increased security, increased developer productivity, decreased deployment and maintenance costs, and an extensive pre-built library for many generic tasks.


Web Applications

The .NET Framework has become an extremely popular technology for Web applications. The Web features in the .NET Framework, known collectively as ASP.NET, are embodied in a rich object model that provides power and scalability well beyond its predecessor ASP (now commonly known as classic ASP). Since its introduction, ASP.NET has been a highly effective


Web Services

XML Web services are part of ASP.NET. A conventional Web page responds to HTTP requests with HTML output. By contrast, Web services are based on SOAP, an XML-based protocol that defines the syntax and rules for exchanging messages between two systems. SOAP messages can be transported over HTTP just like Web page requests, which means you can expose services (for example, Web services) that are accessible through most firewalls that allow traffic on port 80.


Windows Services

A long-standing lament among Visual Basic programmers was the difficulty in creating applications that could run as Windows Services (formerly NT Services). Windows Services are background applications that perform tasks or provide services to other programs. Windows Services are normally started automatically and run regardless of whether any users are logged on. They are controlled by a Windows subsystem called the Service Control Manager. Prior to the .NET Framework, Visual Basic developers had to use third-party tools to create applications that could be run as services. Creating Windows Services applications with the .NET Framework is as easy as creating any other type of application. The service can be written in any .NET-compliant language, including Visual Basic.


Console Applications

An often overlooked but powerful type of application is the console application. Console applications have streams for input and output data rather than the point-and-click interaction model used for GUI applications. Console applications are often called command-line applications. Visual Basic 6 does not offer an easy way to create console applications, but with the .NET Framework you can create console applications in Visual Basic or any .NET-compliant language.


Class Libraries

Maximizing code and binary reuse is a fundamental goal of professional developers. One way you work toward that goal is to design your software solutions so that code is generic and reusable. You then encapsulate that potentially reusable code in class libraries by generating DLL files. For Visual Basic 6 programmers, this process is somewhat analogous to creating a COM DLL project, except the DLL files created by Visual Studio 2005 are not COM components. They are assemblies that contain managed code. (Assemblies are covered later in this chapter.) The classes in these class libraries can be any sort of class, including controls and components (that you can then add to the toolbox in the Visual Studio 2005 IDE), classes that extend the Framework Class Library (for example, specialized forms), or your own classes that you implement completely (for example, classes for business rules).


Smart Device Applications

Windows, console, and Web applications (including Web services) target the .NET Framework. You can also write applications that target the .NET Compact Framework. The .NET Compact Framework is a subset of the full .NET Framework for smart devices. The .NET Compact Framework is optimized to run on devices with reduced resources like memory and screen size (for example, Smartphones and other handheld devices). Visual Studio 2005 includes a smart-device emulator to facilitate the development and debugging of smart-device applications.


Setup and Deployment Projects

You can create several types of setup and deployment projects with Visual Studio 2005. Setup and deployment projects are less important now than they used to be because many deployment issues have been simplified, including eliminating the need to register components used by a single application (that is, private assemblies). But there are still many situations in which you will want to have a robust and professional-looking installation program. Visual Basic 6 developers will find that the setup and deployment projects in Visual Studio 2005 are greatly improved over the Package And Deployment Wizard from Visual Basic 6. The power and flexibility of the development interface and the generation of MSI setup packages for Microsoft Installer gives Visual Basic developers access to features that were previously available only with third-party tools.