Datasheet
Creating Windows Forms
Although C# and .NET are particularly suited to Web development, they still offer splendid support for
so-called fat-client or thick-client apps, applications that have to be installed on the end user’s machine
where most of the processing takes place. This support is from Windows Forms.
A Windows Form is the .NET answer to a Visual Basic 6 Form. To design a graphical window interface,
you just drag controls from a toolbox onto a Windows Form. To determine the window’s behavior, you
write event-handling routines for the form’s controls. A Windows Form project compiles to an exe-
cutable that must be installed alongside the .NET runtime on the end user’s computer. Like other .NET
project types, Windows Form projects are supported by both Visual Basic 2005 and C#. Chapter 23,
“Windows Forms,” examines Windows Forms more closely.
Windows Controls
Although Web Forms and Windows Forms are developed in much the same way, you use different kinds
of controls to populate them. Web Forms use Web server controls, and Windows Forms use Windows
Controls.
A Windows Control is a lot like an ActiveX control. After a Windows Control is implemented, it com-
piles to a DLL that must be installed on the client’s machine. In fact, the .NET SDK provides a utility
that creates a wrapper for ActiveX controls, so that they can be placed on Windows Forms. As is the
case with Web Controls, Windows Control creation involves deriving from a particular class,
System.Windows.Forms.Control.
Windows Services
A Windows Service (originally called an NT Service) is a program designed to run in the background in
Windows NT/2000/XP/2003 (but not Windows 9x). Services are useful where you want a program to
be running continuously and ready to respond to events without having been explicitly started by the
user. A good example would be the World Wide Web Service on Web servers, which listens out for Web
requests from clients.
It is very easy to write services in C#. .NET Framework base classes are available in the
System.Service
Process
namespace that handle many of the boilerplate tasks associated with services, and in addition,
Visual Studio .NET allows you to create a C# Windows Service project, which uses C# source code for a
basic Windows service. Chapter 36, “Windows Services,” explores how to write C# Windows Services.
The Role of C# in the .NET Enterprise
Architecture
C# requires the presence of the .NET runtime, and it will probably be a few years before most clients—
particularly most home computers — have .NET installed. In the meantime, installing a C# application is
likely to mean also installing the .NET redistributable components. Because of that, it is likely that we will
see many C# applications first in the enterprise environment. Indeed, C# arguably presents an outstand-
ing opportunity for organizations that are interested in building robust, n-tiered client-server applications.
24
Chapter 1
05_575341 ch01.qxd 10/4/05 7:03 PM Page 24