February2003February 2003

Class Templates: Bring the Power of Templates to Your .NET Applications with the CodeDOM Namespace

In the .NET Framework, the CodeDOM object model can represent code in a variety of languages. This article examines how source code templates written with the Framework's System.CodeDom and System.CodeDom.Compiler namespaces allow developers to create reusable boilerplate source code that can be shared between projects. Components designed via templates improve productivity and shorten development time.Here C++-style classes and templates are simulated and code is generated in multiple languages through the creation of CodeDOM object graphs. Compiling object graphs and formatting output code are also explained. Adam J. Steinert

BITS: Write Auto-Updating Apps with .NET and the Background Intelligent Transfer Service API

Both the .NET Framework and Windows have some very interesting APIs for creating applications that are capable of updating themselves automatically over a network. There are many advantages to writing your application to update itself like Windows Update does, including convenience for your users, from easier maintenance to network administration. Automatic updates require attention to factors such as discovery, security, and file replacement. In this article, the author covers the BITS API as well as a number of features of the .NET Framework that take care of these facets of auto-updating using the same facilities that the Windows Update uses. Jason Clark

Printing: Preview and Print from Your Windows Forms App with the .NET Printing Namespace

Printing is an integral part of every complete Windows-based application. Providing robust printing capabilities in these applications has often proved to be a tedious chore. Now, printing from Windows Forms with the .NET Framework means you must adopt a document-centric approach, resulting in cleaner and more manageable code. While the System.Windows.Forms namespace provides seamless integration with all the standard print dialogs (such as Print Preview, Page Setup, and Print), the System.Drawing.Printing namespace offers numerous classes for extensibility and customization. These classes, and how they provide access to printing capabilities, are covered here. Other useful techniques, such as printing in the background to allow the user to continue other tasks, is also explained. Alex Calvo

Windows Forms: Give Your .NET-based Application a Fast and Responsive UI with Multiple Threads

If your application performs any non-UI processing on the thread that controls the user interface, it may make the app seem slow and sluggish, frustrating users. But writing multithreaded apps for Windows has long been restricted to C++ developers. Now with the .NET Framework, you can take advantage of multiple threads in C# to control the flow of instructions in your programs and isolate the UI thread for a fast and snappy user interface. This article shows you how. Also, it discusses the pitfalls of multiple threads and presents a framework for safe concurrent thread execution. Ian Griffiths

Delegates in .NET: A Primer on Creating Type-Safe References to Methods in Visual Basic .NET

Delegates, new in Visual Basic .NET, are type-safe, object-oriented references to methods. By using delegates, you make your methods accessible to others and therefore more extensible. This article provides an introduction to delegates, their benefits, and how they are used.Here the author shows you how to declare, create, and use delegates to invoke instance and shared methods at run time, and how to implement delegates as properties. He then goes on to provide examples of how delegates are used for callback functionality and explains the relationship between delegates and events. Finally, the article provides a glimpse at how delegates are implemented in intermediate language code by the Visual Basic .NET compiler. Jesse Liberty

Web-Aware Apps: Build Hyperlinks into Your Client App with the Windows Forms LinkLabel Control

LinkLabels are Windows Forms controls that enable a user to hyperlink to a URL that points to either the Web or the local directory system. While the SDK documentation discusses the control, it does not demonstrate how linking is accomplished, nor does it outline the power and flexibility the control provides. This article fills those gaps, showing how to link using the LinkLabel control. It also shows the flexibility of this control for the programmer using the .NET Framework. In addition, the author covers the large number of properties that allow you to customize your controls and accurately place them. Their built-in behaviors are also discussed, along with their use in both Visual Basic .NET and C#. Dan Hurwitz

Code Download (843 KB)
.Chm Files

Columns

Editor's Note: Rich Clients Count Too

It's the dead of winter here at the MSDN Magazine offices, and we're having a blast. Temperatures are making their daily struggle to stay above zero. The tempting aroma of chestnuts roasting on an open subway ventilation grate fills the city with a wintry mix of excitement and anticipation.

New Stuff: Resources for Your Developer Toolbox

Vektrex Electronic Systems Inc. has announced the launch of a new version of VIVID, a software development toolkit for the generation of IVI-COM-compliant instrument drivers. VIVID links the many IVI Foundation specifications into a full lifecycle environment and produces IVI-COM drivers that are compliant with the latest specifications approved by the IVI Foundation.Theresa W. Carey

Web Q&A: Data Shredding, Updating the Status Bar, and More

Edited by Nancy Michell

The XML Files: XPath Selections and Custom Functions, and More

Aaron Skonnard

Cutting Edge: The ASP.NET View State

In ASP. NET pages, the view state represents the state of the page when it was last processed on the server. It's used to build a call context and retain values across two successive requests for the same page.Dino Esposito

Advanced Basics: Automatically Generating Proxy Classes

Ken Spencer

Basic Instincts: Programming with Events Using .NET

This month's Basic Instincts column builds upon my last two columns in which I talked about concepts and programming techniques associated with delegates. I will assume you have read the last two installments of this column and that you understand the role that delegates play within the Microsoft® .Ted Pattison

The ASP Column: Using the Internet Explorer WebControls

During the lifespan of ASP, there have been many technologies developed for making browser-based user interface development easier. For example, during the early days of classic ASP development, keeping a browser-based UI consistent required many conditional statements into the ASP script.George Shepherd

C++ Q&A: Singleton Class Private Constructor, C# Singleton Class, and More

Paul DiLascia

Resource File: Technical Support Options

Development can have its frustrating moments. How many times have you been in the middle of a project and encountered a problem you just couldn't solve alone? In order to help you through this, Microsoft provides quite a wide variety of support options from Web-based chats and newsgroups to paid premier customer support.