  
Code List for Total .NET SourceBook
Here's a summary of the categories and functions among the many types of 
royalty free code included in Total .NET SourceBook: 
ActiveDirectory 
Active Directory 
Code: GetGroups
Get the list of groups in a domain and return as an ArrayList. 
Code: ListDomainNames
Gets a list of Domain names the user can see on the network. 
HowTo: Logon Types
4 Ways to Logon using WinNT structures for ADSI (ActiveDirectory). 
Code: getComputerProperties
Gets properties for the WinNT Computer in the specified domain 
Code: getGroupMembers
Gets members in the WinNT AD group 
Code: getGroupProperties
Gets properties for the WinNT AD Group 
Code: getGroupTypeFlags
Get the Type of Group it is 
Code: getLoginHours
Function for getting the loginHours for a given user and translating them 
to the actual login hours for the local time 
Code: getUserFlags
Function for getting the UserFlags specified by the integer returned in 
the UserFlags Property 
Code: getUserProperties
Gets properties for the WinNT AD user 
Code: getUsers
Retrieves a list of users in the specified domain 
Code: convertByteToSidString
Converts the Byte array to the SID string without the API 
Code: convertSIDToStringAPI
API for "ConvertSidToStringSid" 
Code: getGroupsUserIsMemberOf
Gets groups the WinNT AD user is a member of and returns the Primary Group for the user 
ADO.NET General 
General code and examples for working with ADO.NET 
Snippet: Add a DataTable to a DataSet
Example of creating a DataTable and adding it to a DataSet object. 
Snippet: Create a DataTable with Constraints, Keys, etc.
This example demonstrates how to create a DataTable with keys constraints, and defaults. 
Snippet: Creating a DataTable
Example of creating a DataTable in code. 
Code: DataSetFromXML
Populate a DataSet from an xml file. 
Code: DataSetToXML
Save a DataSet to an XML file. 
Code: DataSetToXMLString
Instantiate and save DataSet contents in xml format. 
Code: IsDSPopulated
Test a DataSet to see if it contains data. 
Snippet: RecordCount
Get the count of records/rows in a dataset table. 
Code: CSVHelper
Code to read a CSV (comma separated value) file and return a Dataset. 
ADO.NET OleDB 
Code and examples for working with OLEDB datasources using ADO.NET 
Code: GetDataReader
Create and return a DataReader given a valid connection and SQL statement. 
Code: GetDataSet
Create and return a DataSet given a valid connection string and SQL statement. 
Code: GetDataSetFromExcel
Returns a DataSet from the specified range in the specified Microsoft Excel worksheet. 
Code: GetMultiDataSet
Create and return a multi-table DataSet given a valid connection string and an array of tables. 
Code: GetScalarValue
Returns a single value given a connection string, table, and column name. 
Code: OleDbDataToXML
Converts OLEDB data to XML format. 
Code: GetFieldByName
Code to demonstrate how to access data in an OLEDBDataReader using a field name. 
ADO.NET SQL Server 
Code and techniques for working with SQL Server objects and data in ADO.NET. 
Snippet: Connection-Based Transaction Example
Example of using a connection-based transaction to update data in two tables. 
Code: GetDataReader
Create and return a DataReader given a valid connection and SQL statement. 
Code: GetDataSet
Create and return a DataSet given a valid connection string and SQL statement. 
Code: GetMultiDataSet
Create and return a multi-table DataSet given a valid connection string and an array of tables. 
Code: GetScalarValue
Returns a single value given a connection string, table, and column name. 
Snippet: Getting a Stored Procedure's Output Parameters
Example of capturing output parameters from a stored procedure. 
Snippet: Getting a Stored Procedure's Return Value
Example of capturing the return value from a stored procedure. 
Snippet: ReadBLOB
Read a BLOB of data from a column. 
Snippet: ReadBLOBWithDS
Read a BLOB of data with a dataset object. 
Snippet: ShowMultiDataSetRelated
Example of a multi-table DataSet with relations created between tables that are related in the source database. 
HowTo: ShowNestedDataSet
This example illustrates how to create and navigate through nested recordsets. 
Snippet: Simple Delete Example
This illustrates a simple way to execute a delete command against a SQL Server table. 
Snippet: Simple Insert Example
This illustrates a simple way to execute an insert command against a SQL Server table. 
Snippet: Simple Stored Procedure Example
Example of executing a stored procedure with no parameters. 
Snippet: Simple Stored Procedure with Parameters
Simple example of getting data from a stored procedure using input parameters. 
Snippet: Simple Update Example
This illustrates a simple way to execute an insert command against a 
SQL Server table. 
Snippet: Sort and Filter a DataTable
Example of sorting a table in a DataSet by different columns. 
Code: SqlDataToXML
Return SQL data as XML. 
Snippet: Stored Procedure Update Example using Parameters
Example of using a stored procedure that updates data and requires input parameters. 
Snippet: Table and Column Mappings Example
Example of using table and column mappings to customize the names of a DataSet's tables and columns. 
Snippet: Update Data from a DataSet
Example of how to update a data source from a DataSet populated from it. 
Snippet: Update Data with only a DataSet's Modified Data
Example code to Update Data with only a DataSet's Modified Data. 
Snippet: Update from a DataSet using a Stored Procedure
Example code to Update from a DataSet using a Stored Procedure 
Snippet: Update from a DataSet with Auto-Generated Commands
Example code to Update from a DataSet with Auto-Generated Commands 
Snippet: WriteBLOB
WriteBLOB demonstrates how to write image data to a SQL Server table. 
Snippet: WriteBLOBWithDS
WriteBLOBWithDS demonstrates how to write image data to a SQL Server table using a DataSet object. 
Snippet: XML from a Stored Procedure to a File
Example of writing the XML returned from a stored procedure to a file. This example uses the GetProductXML proc in Northwind. 
SQLDMO
Code for working with SQLDMO, the object model for SQL Server 
Code: ListSQLServers
Get a list of available SQL Servers in the current domain. 
Code: DynamicCrosstabQueries
SQL code for creating dynamic crosstab queries. 
HowTo: GetImagePathIntoDatabase
Gets an image from a file, and updates the path in your SQL Server 
database, then loads the picture into the picturebox on a form. 
Other: AuditCheck.SQL
SQL Script to generate Auditing functionality on a SQL Server table. 
ADO Demos
Standalone procedures demonstrating ADO coding techniques 
Code: ColumnComputeAndExpression
Demonstrate ADO computed columns and data column expressions 
Code: CreateRunTimeTable
Demonstrate creating and using a datatable at run-time 
Code: CreateRunTimeTableCloneCopyImportMerge
Demonstrate the ADO Clone, Copy, Import and Merge features 
Code: DataTableFilterByRowState
Demonstrate filtering rows in a datatable by their state 
Code: DataViewFind
Demonstrate finding a DataRowView in a DataView 
Code: FillTableSelect
Demonstrate using a Data Adapter to fill a DataTable using a SQL 
Select statement 
Code: FillTableSelectWithParameter
Demonstrate using a Data Adapter to fill a DataTable using a SQL 
Select statement that includes parameters 
Code: FillTableWithProc
Demonstrate using a Data Adapter to fill a DataTable using a SQL 
stored procedure 
Code: FillTableWithProcInputParams
Demonstrate using a Data Adapter to fill a DataTable using a SQL 
stored procedure with input parameters 
Code: FilterWithDataView
Demonstrate using a DataView to filter rows from a DataTable 
Code: GetDataAdapterSchemaInfo
Demonstrate using an ADO DataAdapter to retrieve schema information 
about a table 
Code: GetDataReaderSchemaInfo
Demonstrate using an ADO DataReader to retrieve schema information 
about a table 
Code: GetOleDBSchemaInfo
Demonstrate using an ADO connection to retrieve OLE schema 
information 
Code: ProcCommandParameters
Demonstrate using stored procedures with parameters with a command 
object, and re-executing with new parameter values 
Code: ProcFillMultipleTables
Demonstrate filling multiple DataTables in a dataset with the results 
of a call to a stored procedure 
Code: ProcFillRelatedTables
Demonstrate filling a DataSet with multiple tables and creating 
relationships between them 
Code: RelatedTablesExpressions
Demonstrate using expressions to refer to related data 
Code: TableSelectRows
Demonstrate using a DataTable's Select method to select a subset of 
rows matching a condition 
BusinessLayerSample
A class that.... 
Other: CreateBooksProcs.sql
T-SQL script to create stored procedures required by the 
BusinessLayerSample class 
Other: CreateLibraryProcs.sql
T-SQL script to create stored procedures required by the 
BusinessLayerSample class 
Other: CreateLibraryTables.sql
T-SQL script to create the tables and relationships required by the 
BusinessLayerSample class 
Class: BusinessLayerSampleObject
Sample Business Layer class to show retrieval and update of data 
Code: TestBusinessLayerSampleObject
Test procedure to demonstrate the use of the BusinessLayerSampleObject class 
Data Utilities
Various data utilities for ADO.NET 
Code: AddOutputParameter
Add an output parameter to the parameters collection 
Code: AddOutputParameter
Add an output parameter to a parameters collection, specifying the 
parameter's type 
Code: CreateParam
Create and return a parameter for a parameters collection 
Code: SetDataTablePrimaryKey
Specify the primary key of a datatable 
Code: SetDataTablePrimaryKey
Specify the primary key for a datatable, optionally specifying that 
the key is an autoincrementing type 
Code: TimestampsDiffer
Code to determine whether two timestamps are different 
Code: ValuesDiffer
Code to determine whether two objects are different 
Data Binding
Code: Form and control databinding example
This form demonstrates databinding to a datatable on a form as well 
as databinding for comboboxes 
Collections
Article: Run-Time-Created DataTables
Tip: Use Run-Time-Created DataTables in place of collections. 
AccessHelper
Code and examples for working with Access datasources using ADO.NET 
Code: ExecuteDataset
Methods to execute OleDbCommands that return a resultset. 
Code: ExecuteNonQuery
Methods to execute OleDbCommands that return no resultset. 
Code: ExecuteReader
Methods to Create and prepare a OleDbCommand, and call ExecuteReader with the appropriate CommandBehavior. 
Code: ExecuteScalar
Methods to execute a OleDbCommand against a specified database specified. 
Code: Utility Methods and Constructors
Utility Methods and Constructors for working with Access datasources using ADO.NET. 
Monitor Access or Jet Connections
Code and examples for listing connections on Access or Jet databases 
Class: JetWatcher
Class to list connections to an Access/Jet database 
Code: JetWatcher Example Form
Example form that shows how to use the JetWatcher class 
ParameterQueryBuilder
Code and example for building parameterized ADO.NET queries. 
Code: ParameterQueryBuilder
Assists building parameterized ADO.NET queries. 
HowTo: ParameterQueryBuilder Example
Example for the ParameterQueryBuilder class. 
QueryReader
Code and examples for filling an ADO.NET dataset in batches, and pausing 
a long-running query.  
Code: Example Form for QueryReader
Example form for using the QueryReader class to fill an ADO.NET 
dataset in batches, and pause a long-running query. 
Class: QueryReader Class
Code for filling an ADO.NET dataset in batches, and pausing a 
long-running query. 
ADO Interface Code and Example
Code and example that creates and consumes a generic IDbConnection and 
IDataAdapter object.  
Class: ADO Interface Class
Shows a generic business layer method that creates and consumes a 
generic IDbConnection and IDataAdapter object.  
Item: ADO Interface Sample Form
Example form for the ADO Interface class. 
TableBuilder
Code and example for building a DataTable from scratch. Add columns, 
specify primary keys, set default values, and more. 
Code: Example Form for TableBuilder
Example form for using the TableBuilder class to create a DataTable 
from scratch. 
Class: TableBuilder Class
Code for creating a DataTable from scratch. Add columns, specify 
primary keys, set default values, and more. 
ASP.NET 
Code, examples, and information for working with Active Server Pages.NET. 
General
General techniques in ASP.NET. 
HowTo: Change Page Background Color
Change an HTML page's background color 
HowTo: GridLayout vs. FlowLayout
HowTo: Scrollable Controls
Snippet: Simple Browser Capabilities Utility
Use basic ASP.NET code to get browser capabilities 
HowTo: Upload Files Larger than 4mb
Module: Data Binding
How to access controls in DataList Header and Footer 
Module: Upload and Download by Streaming
This code sample demonstrates how to upload and download files in 
ASP.NET by streaming. 
Authentication
Code, examples, and techniques for working with Authentication in 
ASP.NET. 
HowTo: Authentication for Different Pages/Directories
Authentication for Different Pages/Directories 
HowTo: Configuring Forms Authentication
HowTo: Configuring Passport Authentication
HowTo: Configuring Windows Authentication
How to configure Windows Authentication 
Snippet: How to Reference the Authenticated Users Name
How to Reference the Authenticated User's Name 
Code: LoginFormsAuth
This method contains the basic steps required to authenticate a user 
using Forms authentication. 
Code: LogoutFormsAuth
Basic code necessary to log the current user out of the application 
when using Forms authentication. 
Code: WindowsAccountDetails
Saves the properties of the current user authenticated with windows 
authentication to a collection. 
Client-Side Behavior
Code, examples, and notes for working with web browsers using client-side 
code. 
HowTo: Add Client-Side Script to a Page from ASP.NET
HowTo: Adding Client Script to a Form
Snippet: Disable Context Menu in the Browser
Use the context menu event to disable the right-click menu. 
Snippet: Open a Page from a Popup Window
Javascript code to open a page. 
HowTo: Prompt User before Button Submits a PostBack
Snippet: Show a Message Box from a Button
Use the Javascript Alert function. 
Snippet: Using DHTML Effects with Web Server Controls
Configuration
Techniques for configuring ASP.NET applications. 
HowTo: Always Show the ASP.NET Error Page
HowTo: Configuring ASP.NET Tracing
How to set up ASP.NET Tracing 
HowTo: Handling Errors with Custom Redirects
HowTo: Handling Errors with Default Redirects
HowTo: Smart Navigation
Information about the ASP.NET SmartNavigation feature to control 
adding pages to the browser's cache. 
Managing State
Code, examples, and notes for managing state in ASP.Net applications. 
Code: Cookieless Sessions
HowTo: Overview of Session State Configuration
Code: ShowCachedItems
Iterate and display all items in the ASP.NET application's cache. 
Security
Code and notes for working with ASP.NET security 
Article: ASP.NET Security Overview
Server Controls - Basics
HowTo: Adding Events to Controls
HowTo: Applying Styles
Snippet: Creating a Password-Masked TextBox
Code: Iterate Through Web Form Controls
Use the controls collection to iterate all controls on a web form. 
Server Controls - Data Binding
Repeated-Value Controls
Article: Data-Binding Expressions
DataGrid
HowTo: Use AlternatingItemStyle on a DataGrid
Define a data grid style that uses different background 
colors for every other row. 
Example of Binding, Paging, and Sorting
This example demonstrates how to bind to multiple data 
sources using a single web form and DataGrid, and how to implement paging and 
sorting in the grid. 
WebForm: DataGridBind.aspx
Class: DataGridBind.aspx.vb
Example of Editing Data
WebForm: DataGridEditBound.aspx
Class: DataGridEditBound.aspx.vb
Example of Filtering Data
Shows how to filter data on a datagrid control. 
WebForm: DataGridFilter.aspx
Class: DataGridFilter.aspx (Code behind)
Example of Finding Data
Shows how to find data on a datagrid control. 
WebForm: DataGridFind.aspx
Class: Code behind for DataGridFind.aspx
DataList
HowTo: Use AlternatingItemStyle on a data list control
Define a data list style that uses different background 
colors for every other row. 
Example of Binding a DataList to a DataTable
Class: Code behind for DataListDataTable.aspx
WebForm: DataListDataTable.aspx
Example of Binding a DataList to a HashTable
How to bind a datalist object to a hashtable object. 
Class: Code behind for DataListKeyValue.aspx
WebForm: DataListKeyValue.aspx
Example of Binding a DataList to Arrays
How to bind a datalist object to an array object. 
Class: Code behind for DataListArray.aspx
WebForm: DataListArray.aspx
DropDownList
HowTo: Firing the SelectedIndexChanged Event
Example of Binding a DropDownList
How to bind data to a dropdownlist control. 
Class: Code behind for ControlsDemo.aspx
WebForm: ControlsDemo.aspx
Single-Value Controls
HowTo: Binding to a Function
HowTo: Binding to Another Control
Caching
Articles, How-To's, and code for how to use caching to create 
high-performance Web applications. 
Application Data Caching
Code, How-To's, and Articles for using Application Data Caching. 
Article: Add
Adding items to the cache with the Add and Insert methods. 
Article: Cache Item Removed Event
Using the Cache Item Removed Event. 
Article: Delete
Using the Remove method to delete items from cache. 
Article: Retrieve
Binding a grid to data from cache. 
Output Caching
Code, How-To's, and Articles for using Output Data Caching. 
Article: Fragment Caching
Fragment Caching to store a version of the control in the output 
cache. 
Article: Page Caching
Setting an expiration for the cached output of a dynamically 
generated page. 
Module: Webservice with Caching
This module demonstrates how an ASP.NET Webservice can be cached for 
performance. 
Validation Web Server Controls
Examples for using ASP.NET's Validation Web Server controls. 
WebForm: Compare Validator Control
This example shows how to use the Compare Validator Control. 
WebForm: Custom Validator Control
This example shows how to use the Custom Validator Control. 
WebForm: Range Validator Control
This example shows how to use the Range Validator Control. 
WebForm: Regular Expression Validator Control
This example shows how to use the Regular Expression Validator 
Control. 
WebForm: Required Field Validator Control
This example shows how to use the Required Field Validator Control. 
WebForm: Validation Summary Control
This example shows how to use the Validation Summary Control. 
Mobile Web Development
Code for Mobile Web Development 
WebForm: Simple Mobile Web Page
Simple Mobile Web Page Using mobile:Link, mobile:Label, 
mobile:PhoneCall and mobile:ObjectList Controls 
Delete Confirmation Code and Examples
Code and example for prompting users to confirm delete operations in 
ASP.NET. 
HowTo: Delete Confirmation
Code for prompting users to confirm delete operations in ASP.NET. 
Delete Confirmation Example
Example for prompting users to confirm delete operations in ASP.NET. 
Item: WebForm1.aspx Code
Example for prompting users to confirm delete operations in ASP.NET. 
Item: WebHelper Code
Example for prompting users to confirm delete operations in ASP.NET. 
ASP.NET ModalDialog
Shows how to create a Modal Dialog, and return values to the parent page. 
Class: ASP.NET ModalDialog Base Page
SubClass Page class to support ModalDialog window 
Class: Code Behind WebForm1.aspx
Code behind the Popup Window (WebForm1.aspx) 
Class: Code Behind WebForm2.aspx
Code behind the WebForm that opens the Popup Window (WebForm2.aspx) 
WebForm: WebForm1.aspx
Popup Window 
WebForm: WebForm2.aspx
Web Form to open Popup Window 
User Controls
WebTreeControl
Server-Side tree control 
Module: AssemblyInfo
TestWebTreeControl
Simple WebForm to demonstrate the usage of WebTreeControl. 
Class: Code behind for Global.asax
Class: Code Behind for Index.aspx
WebForm: Index.aspx
XML: Microsoft Games.xml
Sample data file 
Class: WebTreeControl
Web Control (Visible to Designer) 
Class: WebTreeNode
Represents a single node in the tree control. 
IE WebControls
Code, Tips, and Tricks for using IE Web Controls. 
Article: How to Install Internet Explorer Web Controls
How to Install Internet Explorer Web Controls 
WebForm: MultiPage WebControl Example
MultiPage WebControl Example 
WebForm: TabStrip WebControl Example
TabStrip WebControl Example 
HowTo: Repair IIS Mappings to ASP.NET
Steps to repair IIS mappings to ASP.NET. 
DataGrid Customization
ASP.NET DataGrid Customization 
Code: Highlight and Select Row with JavaScript
ASP.NET DataGrid Customization: Highlight and Select Row with Client-side JavaScript 
Data Structures 
Enumerations
Code: Text File to Enumeration
Code to open a text file and read it into an enumeration. 
General .NET Programming 
General .NET Programming Techniques 
Keyboard
Code for working with the Keyboard in .NET. 
Code: EatKeystrokes
Prevent a control from seeing specific keystrokes 
Windows 32 Keyboard
Work with keyboard attributes through WMI. 
Code: GetKeyboardInfo
Gets Keyboard properties 
Code: GetKeyboardDeviceID
Gets the DeviceID for the Keyboard. Needed for all other Keyboard 
information. 
Processes
Code for working with Processes 
Code: RunProgram
Run an external program. 
Code: ShowRunningProcesses
Show all processes running on this machine. 
Code: ShowRunningUIProcesses
Show all processes running on this machine that have created UI (i.e. 
have windows) 
Code: WaitForProcess
Wait for a process to finish 
Code: TimeoutWaitForProcess
Wait for a process for a specified period of time. 
Code: CountOfApplicationInstances
Return a count of the running instances of the current application. 
Class: FormWindowsTimerManyTimers
This form contains example code that illustrates how efficient 
Windows.Forms.Timer objects are. 
Code: IsAppRunning
Check to see if another instance of the current application is 
already running. 
Code: BatchFileResults
Launch an external command and get the results. 
Miscellaneous
Miscellaneous items for general .NET programming. 
HowTo: Build an Evaluate Function
How to create a replacement for the VB Eval() function 
Class: ClearConsole
Code to clear the console in a Console application 
HowTo: Detect if Code is Running from the IDE
Detect if Code is Running from the IDE 
Code: GetWinVer
Return a string with information about the current Windows Version 
Article: Calling Objects with Optional Parameters from C#
Tip: How to call a COM or VB.NET method with optional parameters from C#. 
Article: Overloading on Overloads
Overloading on Overloads 
Article: TypeCastingInVB
Type Casting in Visual Basic .NET  
Data Structures
Arrays
Snippet: ArrayList as a Substitute for an Array
Snippet: Iterating through an Array
Snippet: Join and Split Strings Example
Code: ReadOnlyArray
Snippet: Searching an Array
Collections
Code: ArrayToStringCollection
Class: GenericCollection
Snippet: SimpleCollection
Code: StringCollectionToArray
Article: Debugging Collections 
Debugging Collections in Your Visual Studio .NET Applications 
Files, Disks and Folders
Code for working with Windows Files, Disk, and Folders 
General
Code: CopyFiles
Copies all files from the specified source directory to the 
specified destination directory.  
Snippet: ListEnvironmentVars
Enumerate Environment Variables using a HashTable 
Code: EraseDirectory
Deletes all items in a directory, including sub dirs and sub dir 
files and the deletes the directory itself. 
Code: GetLocalDrives
Use the System.Management classes to invoke WMI to get a list of 
local drives. 
Code: GetNetworkAdapters
Use the System.Management classes to invoke WMI to get a list of 
network adaptors. 
Code: GetWindowsVersionInfoFromDotNet
Returns information about the Windows OS version using the .Net 
libraries. 
Code: PrintDirectoryTree
Recursively prints a list of directories to the console. 
Code: RecursiveCopyFiles
Recursively copy all files and subdirectories from the specified 
source to the specified destination. 
Code: RecursiveSearchForFiles
Search for files matching the specified pattern in the specified 
directory and all its children. 
Snippet: Using System.IO.Path
Examples showing how to use the System.IO.Path library to work 
with paths. 
Code: WriteFile
Use a FileStream to write a new file. 
Code: WriteToTempFile
Writes the specified text to a temp file and returns the temp 
file path and name 
Class: UNCDrives
A class to show a how to get the UNC mapping from a drive letter. 
Code: ChangeFileNameFromReadOnly
Remove the readonly attribute from the specified file. 
Code: ReturnFileNameAsDate
Generate a new file name based on the current date and time. 
Code: ReadFile
Open the specified file and return its contents as a string. 
Class: GetWindowsVersionInfoFromAPI
Code: GetRunningProcesses
Use the System.Management classes to invoke WMI to get a list of 
running processes. 
Code: ListComputersOnNetwork
Returns a list of all computers on the network and places the 
results in a listview. 
Directory and File Info
Directory and File operations 
Code: AppendToFile
Append Text to a file 
Code: CreateDir
Creates a directory and returns DirectoryInfo Structure for it. 
Code: CreateFile
Create a file 
Code: DeleteDir
Deletes a directory with options to delete subdirectories and 
files recursively. 
Code: DeleteFile
Delete a file 
Code: DirExists
Check for existence of a directory 
Code: FileExists
Check for the existence of a file 
Code: GetCurrentAppDir
Gets the directory the application is open from 
Code: GetDirectoryAttributes
Returns the attributes of any given directory as a string 
Code: GetDirsInPattern
Get a list of directories matching a specific search pattern. 
Code: GetDirsInPatternRecursive
Recursively get a list of directories and subdirectories matching a specified pattern. 
Code: GetFileAttributes
Get the attributes of a file. 
Code: MoveDir
Moves a directory from one location to another. 
Code: MoveFile
Move an existing file to another location 
Code: OpenFileForWrite
Create a file and write to it. 
Code: OpenFileWithParameters
Open a File by specifying specific parameters. 
Code: PopulateDirectories
Populates a TreeView Control with the directories of the drive you specify. This is a Recursive function. 
Code: CompareFiles
Compare to files, byte by byte 
Code: EnsureNoTrailingSlash
Code to ensure that there is no backslash between the end of the 
path and the file name. 
Code: EnsureTrailingSlash
Code to ensure that there is a backslash between the end of the 
path and the file name. 
Logical Disk
Logical Disk information using the WMI Management structure 
Code: GetDeviceID
Code: GetDriveType
Gets the DriveType using System.Management and Win32_LogicalDisk 
Code: GetFileSystem
Code: GetMaximumComponentLength
Code: GetMediaType
Code: GetName
Code: GetQuotasDisabled
Code: GetQuotasIncomplete
Code: GetQuotasRebuilding
Code: GetSize
Code: GetSupportsDiskQuotas
Code: ChkDsk
Code: GetAllDrivePropertiesAvailable
Code: GetCaption
Code: GetCompressed
Code: GetDescription
Code: GetSupportsFileBasedCompression
Code: GetSystemName
Code: GetVolumeDirty
Code: GetVolumeName
Code: GetVolumeSerialNumber
FlatFileBuilder
Utility collection class to assist in creating fixed-column width 
flat text files. 
Code: FlatFileBuilder
Contains the FlatFileBuilder collection class and the 
FlatFileColumn Class. 
Snippet: FlatFileBuilder Demo
Demo for the FlatFileBuilder class. 
HTTP and FTP
Code for working with HTTP and FTP protocols. 
Code: DNSResolveLocalHost
Code: GetIPAddress
Code: LaunchURL
Code: LaunchURLWithChecks
Code: MakeHTTPGetRequest
Code: ResolveHost
Code: WebBrowserToDefaultPage
Mail
Snippet: Send Email
Code: ComposeMail
Launch the default email client to send mail. 
Math
Code: GenRandom
Code: GenRandomBounded
Code: IsCloseTo
Fuzzy Match 
MathAreaVolume
This category contains mathematical functions for determining the 
area and volume of various objects. 
Code: AreaOfCircle
Returns the area of a circle 
Code: AreaOfRectangle
Returns the area of a rectangle 
Code: AreaOfRing
Returns the area of a ring 
Code: AreaOfSphere
Returns the area of a sphere 
Code: AreaOfSquare
Returns the area of a square given the length of one side 
Code: AreaOfSquareDiag
Returns the area of a square given the length of the diagonal 
Code: AreaOfTrapezoid
Returns the area of a trapezoid 
Code: AreaOfTriangle
Returns the area of a triangle 
Code: AreaOfTriangle2
Returns the area of a triangle 
Code: LenOfRectangleDiagonal
Returns the length of the diagonal of a rectangle 
Code: LenOfSquareDiagonal
Returns the length of the diagonal of a square 
Code: VolOfCone
Returns the volume of a cone 
Code: VolOfCylinder
Returns the volume of a cylinder 
Code: VolOfPipe
Returns the volume of a pipe 
Code: VolOfPyramid
Returns the volume of a pyramid or cone 
Code: VolOfSphere
Returns the volume of a sphere 
Code: VolOfTruncPyramid
Returns the volume of a truncated pyramid 
MathGeneral
This category contains general math routines, such as rounding, 
factorials, and determining the minimum and maximum values from a set of 
numbers. 
Code: ComputeWindChillEnglish
Calculate the wind chill for exposed human skin 
Code: ComputeWindChillMetric
Calculate the wind chill for exposed human skin 
Code: GetGCF
Returns the greatest common factor (largest number that evenly 
divides into two numbers) 
Code: GetRandomInt
Returns a random integer value between the range specified in the 
arguments, inclusive 
Code: IsNumberPrime
Determines if a number is a prime number 
Code: MaxOfThree
Returns the greatest of three values (null values are ignored) 
Code: MinOfThree
Returns the smallest of three values (null values are ignored) 
Code: PrimeFactors
This procedure calculates the prime factors of a number 
Code: ScalePercent
Scales a value to a range between 0 and 100 (number could be less 
than 0 or greater than 100 if the 'current' value is less than 0 or greater than 
the 'max' value) 
Code: Subtract
Subtract two numbers with decimals correctly 
Code: RoundDown (corrected)
Rounds the passed number to specified number of decimal places 
with 0.5 rounded down 
Code: RoundUp (corrected)
Rounds a number to a specified number of decimal places (0.5 is 
rounded up) 
MathStatistics
Mathematical functions covering the areas of statistics and 
probability 
Code: CoefficientOfVar
Returns the coefficient of variance 
Code: Factorial
Returns the factorial of a given number 
Code: FactorialRecursive
Returns the recursive factorial of a given number 
Code: GetArrayMean
Returns the mean (average) of the elements in the supplied array 
Code: GetArrayMedian
Returns the median of the elements in the supplied array 
Code: GetArrayMode
Returns the mode (most common value) of the supplied array. If 
there is a tie, the smallest number is the mode. 
Code: GetNumberCombinations
Returns the number of combinations of items that can be derived 
from a population (order does not matter) 
Code: GetNumberPermutations
Returns the number of combinations of Items that can occur from 
Pool (order matters) 
Code: StdDev
Returns the standard deviation of the array 
Code: StdError
Returns the standard error 
Code: SumElements
Returns the sum of array elements 
Code: SumOfSquaredElements
Returns the sum of the square of array elements 
Code: VarianceOfArray
Returns the variance of the array 
MathTrigonometry
Code that covers derived math functions for trigonometry, including 
cosines, tangents and secants. 
Code: ArcCoSecant
Returns the inverse cosecant of the supplied number 
Code: ArcCotangent
Returns the inverse cotangent of the supplied number 
Code: ArcSecant
Returns the inverse secant of the supplied number 
Code: CoSecant
Returns the CoSecant of the supplied number. Note that sin(num) 
cannot equal zero. This can happen if num is a multiple of cdblPI. 
Code: CoTangent
Returns the Cotangent of the supplied number. Function is 
undefined if input value is a multiple of PI. 
Code: HyperbolicArcCosecant
Returns the Inverse Hyperbolic Cosecant of the supplied number 
Code: HyperbolicArcCosine
Returns the Inverse Hyperbolic Cosine of the supplied number. 
Code: HyperbolicArcCotangent
Returns the Inverse Hyperbolic Tangent of the supplied number. Undefined if num is 1. 
Code: HyperbolicArcSecant
Returns the Inverse Hyperbolic Secant of the supplied number 
Code: HyperbolicArcSine
Returns the Inverse Hyperbolic Sine of the supplied number 
Code: HyperbolicArctan
Returns the Inverse Hyperbolic Tangent of the supplied number. The return value is undefined if input value is 1. 
Code: HyperbolicCosecant
Returns the Hyperbolic Cosecant of the supplied number. 
Code: HyperbolicCotangent
Returns the Hyperbolic CoTangent of the supplied number 
Code: HyperbolicSecant
Returns the Hyperbolic Secant of the supplied number. 
Code: Secant
Returns the secant of the supplied number 
Unit Conversions
Functions for performing unit conversions 
Class: Unit Conversions
Functions for performing unit conversions 
Item: BMI Calculator
Code and example for calculating BMI (Body Mass Index) 
Diagnostics
Shows examples of using the System.Diagnostics namespace 
EventLogs
Code: ClearLogEntries
Clears all log entries from the specified log 
Code: DeleteLog
Deletes the specified log 
Code: NewEventLog
Creates a new log and an entry, and optionally clears or deletes 
it 
Code: WriteLogEntry
Writes an entry to an existing log 
Processes
Provides access to local and remote processes and enables you to 
start and stop local system processes 
Code: GetBasePriorities
Returns a hash table containing the name and base priority for 
each process currently running 
Code: GetProcessInfo
Returns a hash table containing information about the current 
process 
Code: StartProcess
Starts the specified process 
Code: StartProcessWithParameters
Starts the specified process with parameters 
Web EventLog (I)
Web application to show view EventLog 
Class: Code behind for EventLogConsole.aspx
Class: EventEntry
WebForm: EventLogConsole.aspx
XML: Web.Config
Web EventLog (II)
Web application to show view EventLog 
Class: Code behind for Default.aspx
WebForm: Default.aspx
Class: EventLogHelper
XML: Web.Config
Web Performance Monitor
Web application to show current performance counters' reading 
Class: Code behind for PerfMonConsole.aspx
Class: Global.asax
Class: PerfCounter
WebForm: PerfMonConsole.aspx
XML: Web.Config
Registry
Code for reading from and writing to the registry 
Code: CreateKeyAndSubKey
Creates a new key and subkey under the specified HKEY node 
Code: DeleteKeyValue
Deletes a value from the specified subkey 
Code: DeleteSubKey
Deletes a subkey and all of its subkeys 
Code: DeleteSubKeyWithNoSubItems
Deletes a subkey only if it has no subkeys 
Code: GetKeyValues
Returns a hashtable containing all value names and values for the 
specified subkey 
Code: GetSubkeyCount
Returns a count of subkeys for the specified key 
Code: GetSubKeyNames
Returns an array of the subkeys in the specified key 
Code: GetValueCount
Returns a count of values in a subkey 
Code: SetKeyValue
Sets the default value for the specified subkey  
Strings
Code: ArrayToString
Converts the passed array to a delimited string 
Module: CharacterType
Illustrates how to determine what type of character is in the 
specified location 
Code: CleanAmpersand
Doubles every ampersand character in the input string to replace the 
hot key with an ampersand character 
Code: CleanQuotes
Coverts double-quote (") characters in a string to apostrophes (') 
Code: ContainsAlpha
Determines if there are alpha characters other than "-" in the 
supplied string 
Code: CountDelimitedWords
Returns the number of words in a delimited string 
Code: CountOccurrences
Returns the number of times a string appears in a string 
Code: CountWords
Returns the number of words separated by spaces 
Code: EncloseString
Wraps the string in the specified characters 
Code: FillString
Generates a string of repeated characters 
Code: GenRandomPassword
Generates a random string suitable for a password 
Code: GetDelimitedWord
Returns a word from a delimited string 
Code: InsertString
Inserts one string into another at the specified location. 
Code: LowerCase
Converts the passed string to lower case 
Code: NumberSuffix
Converts an integer into a string with a trailing suffix 
Code: PadLeftString
Left-pads a string to intStrLength characters for right justification 
Code: PadRightString
PadRightString 
Code: ProperCase
Converts the passed string to proper case 
Code: StringToArrayOfWords
Converts a delimited string to an array of words 
Code: UpperCase
Converts the passed string to upper case 
Code: ValidateUSZip
Formats the supplied US zip code 
Code: EncodeAsBase64
Encodes the input string as Base64 and returns it as a byte array 
Code: DecodeFromBase64
Decodes the passed base64 byte array back into a string 
Code: TextToHTML
Encode text in an HTML safe manner by delimiting special characters. 
Snippet: A String as an Array of Characters
Code: Concat
Snippet: Copy a String
Snippet: Copy Part of a String
Code: FindCharacterInString
Code: FindCharactersInString
Code: GenGUID
Code: InsertString
Snippet: Match the End of a String
Snippet: Match the Start of a String
Code: Remove
Snippet: Remove and Replace a String
Code: Replace
Snippet: String Formatting Examples
Snippet: Substring Example
Snippet: Test Equality of Two Strings
Code: GenRandomPassword
Generates a random string suitable for a password 
Article: String Addition in .NET
This article discusses when and how to use the StringBuilder class, 
and when it's not worth the trouble. 
Date and Time
modDateTime
Code: AddWeekday
Code: DaysInMonth
Code: Difference in dates - Whole and Fractional
Returns the number of whole days between two dates 
Code: Difference in minutes - Whole and Fractional
Returns the number of whole minutes between two date/time values. 
Code: Difference in Seconds
Code: DiffWeekdays
Code: DiffWeeks
Code: IsLeapYear
Code: MonthFirstDay
Code: MonthFirstWeekday
Code: MonthLastDay
Code: MonthLastWeekday
Code: NextDate
Code: NextWeekday
Code: PriorDate
Code: PriorWeekday
Code: QuarterFirstDay
Code: QuarterLastDay
gets the last day in the quarter 
Code: YearsBetweenDates
Code: IsDate
Code: NextDayOfWeek
Code: PriorDayOfWeek
Other
Code: Enumerators in C#
Code: VBScript DateDiff C# Sample
Code: Add Day 
User must specify the number of days 
Class: CBusinessDates
Code for calculating business days 
Threading
Code for working with the System.Thread class 
Code: SetAppPriority
Change the priority of the application's thread. 
Reflection
System.Reflection Namespace 
Assembly Info
Using classes under System.Reflection namespace to query class info 
in an assembly (Similar to a object browser) 
WebForm: AssemblyInfo.aspx
Demo the usage of ReflectionHelper class 
Class: Code behind for AssemblyInfo.aspx
Code behind file for Default.aspx 
Class: ReflectionHelper
Helper class to query assembly info 
XML: Web.Config
Late Binding
Load assembly, get type, create object instance, invoke method 
(static, member) and get property 
WebForm: LateBinding.aspx
Class: LateBinding.aspx
XML: Web.Config
Resource
System.Resources, System.Globalization namespaces 
Build Resource DLL
Read and write resource (including normal string and object) 
Class: BinaryResource
Simple WinForm to demo how to add resources into DLL 
Other: Build.bat
Batch file to compile helper class and resources into DLL 
Class: RecourceHelper
Helper Class that is built into the DLL. 
ResourceManager Demo
Simple ASP.NET application to use the resources in "Build Resource 
DLL" 
Class: Code Behind for Default.aspx
Class: Code Behind for RenderImage.aspx
WebForm: Default.aspx
WebForm: RenderImage.aspx
Show image on fly 
Exception Handling
Class: ExceptionHandler
A class for handling and logging exceptions 
HowTo: Re-throwing an Exception
How to re-throw an exception without clearing the stack trace. 
Clipboard
Code examples for System.Windows.Forms.Clipboard 
Snippet: CopyAndPastePictureFromFile
Copies an image from a file to the clipboard, and pastes it into a 
rich text box 
Snippet: CopyAndPasteSelectedText
Takes the selected text from a text box and puts it on the clipboard, 
and pastes it into another text box 
Snippet: ScreenshotOfCurrentApp
Takes a screenshot of the current application and puts the screenshot 
into a picture box. 
Networking
Code for general networking issues in Windows 
Code: GetNetworkInfo
Get network information 
Code: InternetConnectionExists
Determines if there is a connection to the Internet. 
Code: InternetConnectionExists2
Determines if there is a connection to the Internet. 
Class: InternetDialup
A class to handle Internet Dialups through Interop. 
Code: TestSQLServerConnection
Test a connection to a SQL Server by IP address or name 
Code: GetDomainComputers
Retrieves a list of computers in a domain. 
Enumerations
Enumerations 
Table To Enumeration
Table To Enumeration 
Code: RunTimeEnum
Turn values from a datatable into an enumeration at run-time 
using reflection. 
Snippet: Test Driver for RunTimeEnum
Test Driver for RunTimeEnum code. 
MCI Interface
Code for working the Multimedia Control Interface (MCI) 
Code: Open and Close CD Door
Code that shows how to use the MCI interface to interact with the CD 
door 
Code: Play WAV File
Use the MCI interface to play a wav file 
Sorting
List sorting algorithms 
Code: Bubble Sort
Code and notes about the Bubble Sort algorithm. 
Code: Shell Sort
Code and notes about the Shell Sort algorithm. 
Code: Heap Sort
Code and notes about the Heap Sort algorithm. 
Code: Quick Sort
Code and notes about the Quick Sort algorithm. 
Flat File Builder
Building a comma delimited file 
Code: Example
Simple user interface to execute the flat file builder. 
Code: Flat File Builder
DisposePattern
This code shows the recommended way to create a .NET class that is GC 
(Garbage Collector) friendly.  
Class: DisposePattern
This code shows the recommended way to create a .NET class that is GC 
(Garbage Collector) friendly.  
CodeDOM
Demonstrates using Code Document Object Model (CodeDOM) to generate code 
in multiple languages at run-time. 
Class: CodeGenerator
Code to generate VB and C# code using CodeDOM 
Item: CodeGenerator Example
Example form for the CodeGenerator class. 
Hourglass
Code and example to display hourglass while processing; demonstrates 
using Constructors, Dispose method, and C# Using. 
Class: FMSHourglass Class
Display hourglass while processing; demonstrates using Constructors, 
Dispose method, and C# Using. 
Item: Hourglass Example Form
Example form for FMSHourglass class 
ScreenScrape
Code and example form to demonstrate programmatically extracting data 
from the Internet. 
Class: StockTicker Class
Class to demonstrate the ScreenScrape technique. 
Item: StockTicker Example Form
Example form for the StockTicker class 
Article: IIF vs. If...Then...Else
Article explaining the difference between IIF and If...Then...Else 
HowTo: Obsolete Attribute
Using the Obsolete attribute to refactor and manage your source code 
Article: Managing Namespaces in VB.NET
Article explaining Namespaces in VB.NET 
UndoRedo
Undo/Redo manager and example to demonstrate how to undo or redo the last 
operation 
Class: UndoRedo
Undo/Redo manager class to allow users to undo or redo the last 
operation 
Item: UndoRedo Example
Console Application that demonstrates how to use the Undo/Redo 
manager class 
HowTo: Retrieve RSS Feeds
Information and example for retrieving RSS feeds. 
Mortgage Calculator
Code and example for Mortgage Calculator 
Class: Mortgage Calculator Class
Engine for Mortgage Calculations 
Item: Mortgage Calculator Example
Example Form for Mortgage Calculator 
Impersonation
Code to impersonate users in .NET applications. 
Code: Impersonation
Code to impersonate users in .NET applications. 
HowTo: Impersonation Example
Example code for the Impersonation code 
Graphics, Images and Drawing 
Code for working with graphics, images and drawing with classes from the 
System.Drawing namespace 
Fonts
Code and examples for working with System.Drawing.Font objects 
Code: DrawShadowedText
Draw text with a 'shadow' effect 
Code: DrawTextWithBitmapBrush
Load a bitmap and use it as the texture for the brush to draw text 
Code: DrawTextWithGradient
Draw text using a gradient brush 
Code: EnumerateFontNames
Enumerate all fonts and returns a string containing their names. 
Code: EnumerateFonts
Enumerate all fonts and return a string of their names and basic 
information 
Code: GetGenericFontInfo
Return information on the system's generic font for each of the three 
basic font types. 
Code: RotateText
Draw rotated text on a label control 
Code: SetBasicFont
Sets basic font attributes on the passed label control 
Code: FixUnsupportedFontStyle
Given a passed font and style, returns a font style where the style 
is supported by the specified font family. 
Forms and Controls
Change the appearance of Windows Forms and Controls. 
HowTo: ChangeButtonBorder
Change the Appearance of a Button 
Snippet: ChangeLabelBorderColor
Change the border color of a label 
HowTo: Draw a non-rectangular form
Draw a non-rectangular form 
Code: FormAlphaTransparency
Fade a form in and out of view using the Opacity property 
Snippet: Animate GIF Images
Code to show how to start and stop GIF animations 
Article: Using Windows XP Themes
An updated article about how you can take advantage of Windows XP 
themes in your applications. 
Images
Code and examples for working with images such as bmp, jpeg, and gif 
files. 
Code: ConvertToGreyscale
Code: DrawAndSave
Code: PaintImageOnForm
Paint an image loaded from a file directly on the form. 
Code: ResizeImage
Code: SetImageQuality
Snippet: WriteIconsToFile
Read all icons in an ImageList and write them to a file 
Shapes
Code and examples for drawing shapes. 
Code: DrawLine
Use the graphics methods to draw lines on a form 
Code: DrawArc
Use the graphics methods to draw arcs on a form 
Code: DrawClosedCurve
Use the graphics methods do draw a closed curve on a form. 
Thumbnail Creator
Web-based Thumbnail creator. it can also rotate / flip the image. 
Class: Code behind for Default.aspx
Code behind file for Default.aspx 
Class: Code behind for RenderImage.aspx
Code behind file for RenderImage.aspx 
WebForm: Default.aspx
WebForm: RenderImage.aspx
Colors
Code for working with Colors 
Code: ConvertColorToUInt32
Convert a color to an unsigned integer. 
Snippet: Working with Colors
Illustrate different methods of creating and using colors 
Microsoft Server and Application Technologies 
Commerce Server 2002
Content Selection
Module: List Advertisements
This function can be used to retrieve a list of advertisements. 
Order Process
Address
Module: Create Address and Attach to Basket
These functions demo how to create an address object and add it to Basket. 
Billing
Module: Save Billing Info-Credit Card
This function demos how to save credit card payment info into basket. 
OrderForm
Module: Add and Remove LineItem
This function is used to add a new product into OrderForm / 
remove a existing product out of OrderForm. 
Module: Add OrderForm to Basket
This function is used to add an OrderForm object into a 
Basket object. 
Module: Get OrderForm
These functions demos how to get OrderForm object. 
OrderGroup (Basket or PurchaseOrder)
Module: Add OrderForm to Basket
This function is used to add an OrderForm object into a 
Basket object. 
Module: Get Basket
This functions is used to get Basket / OrderForm object. 
Module: Refresh Basket or Checkout
These function is used to refresh the status of the current 
Basket by running it through Basket Pipeline. 
Module: Retrieve OrderGroup
These functions demo how to retrieve a specific OrderGroup or 
all the OrderGroups of a user. 
Shipping
Module: List Shipping Methods
This function demos how to retrieve list of available 
shipping methods available. 
Module: Save Shipping Info
These functions demo how to save shipping info for LineItem 
and OrderForm levels. 
Product Catalog
Module: GetProductDetail
This function is used to retrieve detail product info of a 
ProductID. 
Module: GetRootCategories
This code is used to retrieve list of root categories in a 
product catalog. 
Module: GetSubCategoriesProducts
This function is used to retrieve all products and sub categories 
under a category in a catalog. 
Module: SearchProductsByFreeText (Filter, Paging and Sort)
This function is used to perform freetext search on products. 
Module: SearchProductsByFreeText (Simple)
This function is used to perform freetext search on products. 
Module: SearchProductsByProperty (Filter, Paging and Sort)
This function is used to perform search on product's properties. 
Module: SearchProductsByProperty (Simple)
This function is used to perform search on product's properties. 
Profile
Snippet: CreateUserObject
This piece of code demos how to create a new userobject 
programmatically. 
Snippet: UpdateUserObject
This piece of code demos how to update a userobject 
programmatically. 
Module: VerifyUserLogin
This function is used to verify user's userid/password. 
BizTalk Server 2002
Configuration
Module: Create Configuration
Module: Get Configuration
Get BizTalk Server Messaging Service configuration. 
Messaging Service
Class: AIC
This sample class demos how to create an AIC implementing 
IBTSAppIntegration interface. 
Class: Preprocessor
MSMQ
Search / edit MSMQ, create / view / delete messages 
Class: Common
This is a helper class for log error into event log. 
Class: frmMessage
Class: frmMSMQ
Class: frmMSMQProperty
Microsoft Office
Code: AnimationCharacter
Code: AssistantAnimations
Code: AssistantAskAbortRetryIgnore
Code: AssistantAskAllYesNoCancel
Code: AssistantAskOKCancel
Code: AssistantAskYesNo
Code: AssistantAskYesNoCancel
Code: CmdBarCopy
Exchange Server 2000
Code for working with Microsoft Exchange. 
HowTo: Using WebDAV to Access Exchange 2000
Code to create and delete contact folders and items in Exchange via 
WebDAV 
SQL Server
Code and techniques for working with SQL Server objects and data in 
ADO.NET. 
HowTo: SQL Server 2005 CLR Support
How to enable SQL Server 2005 CLR support
 
.NET Framework 2.0 
Example code, classes, routines, and tips for working with the .NET Framework 
2.0. 
ADO.NET
Example code, classes, routines and tips for working with ADO.NET 2.0 
Configuration: app.config
Application configuration file for ADO.NET sample code. 
WinForm: FormMain
Application Startup form 
WinForm: FormAsyncDataReaderDemo
Example form that demonstrates using begin/end pattern to call 
DataReader asynchronously. 
WinForm: FormTransaction
Demonstrates using TransactionScope to do distributed transactions 
using TransactionScope. 
WinForm: FormMARSDemo
Demonstrates how to use MARS feature in SQL Server 2005. 
WinForm: FormMultipleResultSetDemo
Demonstrates how to use the NextResult() method to get batch command 
result sets from DataReader. 
Class: FormAsyncDataReaderDemo (Designer code)
Code behind FormAsyncDataReaderDemo.  
Class: FormMain (Designer code)
Code behind FormMain. 
Class: FormMARSDemo (Designer code)
Code behind FormMARSDemo. 
Class: FormMultipleResultSetDemo (Designer code)
Code behind FormMultipleResultSetDemo.  
Class: FormTransaction (Designer code)
Code behind FormTransaction.  
Windows Forms
Code, tips and techniques for working with the .NET Windows Forms. 
WinForm: FormMain
Application startup form, which is used to call up the Windows Forms 
examples.  
Client Settings
Visual Studio.NET 2005's new way of storing and retrieving client 
configuration settings 
WinForm: FormSettings
Demonstrates Visual Studio 2005's new way of storing and 
retrieving client configuration settings 
Class: FormSettings (Designer code)
Code behind FormSettings 
Class: FormMain (Designer code)
Windows Form Designer generated code 
BackgroundWorker
Demonstrates how to use the BackgroundWorker class 
WinForm: FormBackgroundWorker
Demonstrates how to use the BackgroundWorker class 
Class: FormBackgroundWorker (Designer code)
Code behind FormBackgroundWorker 
ASP.NET
Example code, classes, routines and tips for working with ASP.NET 2.0 
Configuration: web.config
Web configuration file for ASP.NET 2.0 examples. 
Themes
Code and examples for working with ASP.NET 2.0 Themes 
WebForm: Default.aspx
Demonstrates using Themes in ASP.NET 2.0. 
Class: Theme Helper
Helper class that lists all local themes. 
Sample Themes
Sample themes for ASP.NET 2.0. 
MSN_Blue Theme
Sample theme for ASP.NET 2.0. 
Other: default.css
Cascading style sheet for MSN_Blue Theme. 
Configuration: default.skin
Skin definition file for MSN_Blue Theme. 
MSN_Purple Theme
Sample theme for ASP.NET 2.0. 
Other: default.css
Cascading style sheet for MSN_Purple Theme. 
Configuration: default.skin
Skin definition file for MSN_Purple Theme. 
MSN_Red Theme
Sample theme for ASP.NET 2.0. 
Other: default.css
Cascading style sheet for MSN_Red Theme. 
Configuration: default.skin
Skin definition file for MSN_Red Theme. 
Configuration: web.config
Web configuration file for Themes examples. Sets the default 
theme to "MSN_Blue". 
Class: Default.aspx (Code behind)
Code behind Default.aspx 
HowTo: Encrypt Configuration
How to use RSA Protected Configuration provider and aspnet_regiis.exe 
tool to encrypt sections of configuration files. 
GridView DetailView FormView
Code and examples to demonstrate the GridView, FormView, and 
DetailView controls in ASP.NET 2.0. 
WebForm: GridViewDemo.aspx
Demonstrates how to use the GridView control in ASP.NET 2.0. 
Class: GridViewDemo.aspx (Code behind)
Code behind GridViewDemo.aspx 
WebForm: FormViewDemo.aspx
Demonstrates how to use the FormView control in ASP.NET 2.0. 
Class: FormViewDemo.aspx (Code behind)
Code behind FormViewDemo.aspx 
WebForm: DetailViewDemo.aspx
Demonstrates how to use the DetailView control in ASP.NET 2.0. 
Class: DetailViewDemo.aspx (Code behind)
Code behind DetailViewDemo.aspx 
XML: NorthWindDataSet.xsd
Strongly Typed DataSet 
SiteMap Provider
Code and example WebForms for a customized ASP.NET SiteMap Provider 
Class: SiteMap Provider
Customized ASP.NET SiteMap Provider 
WebForm: Default.aspx
Default WebForm for SiteMap provider, which demonstrates customized SiteMap providers. 
Class: Default.aspx (Code behind)
Code behind Default.aspx 
WebForm: Products.aspx
Example WebForm that demonstrates using a customized SiteMap provider in ASP.NET 2.0. 
Class: Products.aspx (Code behind)
Code behind Products.aspx 
Client Callbacks
Code and examples for using client callbacks to call server-side 
methods without posting back the entire page. 
Class: Default.aspx (Code behind)
Code behind Default.aspx 
WebForm: Default.aspx
Default WebForm for ClientCallbacks, which demonstrates ASP.NET 
2.0's Client Callback feature. 
WebForm: FileExplorer.aspx
Web form that demonstrates ASP.NET 2.0's Client Callback feature. 
Class: FileExplorer.aspx (Code behind)
Code behind FileExplorer.aspx 
Configuration: Web.config
Web configuration file for Client Callback example. 
Profile Provider
Code and example WebForms for a customized Profile Provider that is 
optimized for SQL Server 2005 
Class: Sql2005 Profile Provider
Demonstrates using customized ASP.NET profile providers in a way 
that is optimized for SQL Server 2005. 
Other: Update ASP.NET Membership Database
SQL script to update the database structure of ASP.NET 2.0 
membership database.  
Class: Default.aspx (Code behind)
Code behind Default.aspx 
WebForm: Default.aspx
Default WebForm for ProfileProvider. Demonstrates using profile 
providers optimized for SQL Server 2005. 
SQL Server 2005
Code and examples for using CLR Integration with SQL Server 2005 and .NET 
Framework 2.0 
Other: Test.sql
Shows how to use the samples in the SQL Server category. 
Class: Exponential Moving Average
Demonstrates creating a CLR Stored Procedure to return a data set. 
Class: Regex Functions
Demonstrates creating Scalar-Valued CLR functions. 
Class: Simple Moving Average
Demonstrates creating Table-Valued CLR function 
Class: Standard Deviation (1)
Demonstrates creating CLR aggregation functions. 
Class: Standard Deviation (2)
Demonstrates creating CLR aggregation functions. 
Class: Universal Weight
Demonstrates creating CLR user data type. 
Class: Validate Price
Demonstrates creating a CLR trigger. 
Generics Tutorials
Example code, classes, routines and tips for working with Generics in 
Visual Studio 2005. 
Class: CollectionEx
Generic Helper class for Collection. 
Class: Node
Demonstrates using the Default keyword to initialize variables in 
generic code. 
Class: NodeConstraints
Demonstrates Constructor and Reference constraints. 
Class: NullableType
Demonstrates using Nullable types 
Class: Program
Entry point for Generics tutorials application; runs all tutorials. 
Class: SingleLinkedList
Demonstrates using a generic class with multiple types. 
Class: SingleLinkedListConstraints
Demonstrates using Reference/Value type constraints 
Class: SingleLinkedListIComparable
Demonstrates using Generic constraints and Inheritance. 
Class: Stack
Generic class with single type. 
Class: StackDelegate (Part 1)
Demonstrates using an Anonymous method and Generic delegate 
Class: StackICollection
Demonstrates implementing Iterator, IEnumerator, and ICollection. 
Class: StackDelegate (Part 2)
Demonstrates using Partial Class and Generic operator overloading. 
Security
Code and examples for working with the System.Security.Cryptography namespace. 
Symmetric Crypto Algorithms
Code and examples for the Symmetric Crypto algorithms in the System.Security.Cryptography namespace 
WinForm: FormSymmetricTest
Demonstrates using the Symmetric Crypto Helper class 
Class: Symmetric Crypto Helper
Demonstrates using Rijndael / TripleDES / RC2 / DES algorithms to do symmetric encryption / decryption. 
Class: FormSymmetricTest (Designer code)
Code behind FormSymmetricTest 
Asymmetric Crypto Algorithms
Code and examples for the Asymmetric algorithms in System.Security.Cryptography. 
Class: Asymmetric Crypto Helper
Uses RSA algorithm to do asymmetric encryption/decryption. 
WinForm: FormAsymmetricTest
Demonstrates using the Asymmetric Crypto Helper class. 
Class: FormAsymmetricTest (Designer code)
Code behind FormAsymmetricTest 
Hash Algorithms
Code and examples for the Hash algorithms in the 
System.Security.Cryptography namespace 
WinForm: FormHashTest
Demonstrates using the Hash Helper class.  
Class: Hash Helper
Helper class used to compute a Hash value. 
Class: FormHashTest (Designer code)
Code behind FormHashTest 
WinForm: FormMain
Application startup form, which is used to call up the Security 
examples.  
Class: FormMain (Designer code)
Code behind FormMain, which is used to call up the Security examples. 
Visual Studio.NET
Code and examples for working with Visual Studio .NET. 
Visualizers
Code and examples for working with Visualizers in Visual Studio .NET 
SqlCommand Debug Visualizer
Debug Visualizer for SqlCommand object in VS.NET 2005 
WinForm: FormShowSqlCommand
User Interface for SqlCommand debug visualizer. 
Class: FormShowSqlCommand (Designer code)
Code behind FormShowSqlCommand 
Class: SqlCommand Visualizer
Entry point for the SqlCommand debugger visualizer 
Class: SqlCommand VisualizerInfo
Converts regular SqlCommand to be serializable. 
Class: SqlCommand VisualizerSource
VisualizerObjectSource for SqlCommand Visualizer. 
Data Binding
Samples to demonstrate new data binding features in the .NET Framework 
2.0 in Windows Forms. 
Configuration: app.config
Application configuration file for DataBinding code. 
Object DataSource
Demonstrates setting up a bind to Object Data Source, and creating a 
Master-Detail display in a single or 2 forms. 
Class: Product
Product collection for use with the Object DataSource examples.  
Class: ProductsWithLog
Product collection that keeps a log of changes to the collection.  
WinForm: FormProduct
Detail form, which displays the Product details. 
WinForm: FormProductsWithLog
Parent (or Master) form, which displays a list of products. 
Class: FormProduct (Designer code)
Code behind FormProduct 
Class: FormProductsWithLog (Designer code)
Code behind FormProductsWithLog, which displays a list of 
products. 
Binding Source
Demonstrates how to set up data binding using Design Time support and 
using code. 
XML: AdventureWorksDataSet.xsd
Strongly Typed DataSet 
WinForm: FormAllInCode
Demonstrates using code to set up BindingSource, which in turn 
binds to a Strongly-Typed Dataset. 
WinForm: FormDesignTime
Demonstrates using VS.NET 2005 design time features to set up 
BindingSource, which in turn binds to a Strongly-Typed Dataset. 
Class: FormAllInCode (Designer code)
Code behind FormAllInCode. 
Class: FormDesignTime (Designer code)
Code behind FormDesignTime.  
Enhanced BindingList
Demonstrates enhancing BindingList to add Sorting and Searching 
capabilities. 
Class: Enhanced BindingList Class
Helper class built on top of BindingList to add Sorting and 
Searching capabilities. 
Class: Product
Product collection for use with the Enhanced BindingList 
examples. 
Class: Property Comparer
Generic helper class for BindingListEx to do property comparison. 
WinForm: FormBindingListExDemo
Example form for Enhanced BindingList class, which adds searching 
and sorting capabilities to BindingList. 
Class: FormBindingListExDemo (Designer code)
Code behind FormBindingListExDemo 
WinForm: FormMain
Application startup form, which is used to call up the DataBinding 
examples. 
Class: FormMain (Designer Code)
Code behind FormMain 
Partial Class
Sample code for using Partial Classes 
Class: Part 1 of PartialClassDemo
First part of the PartialClassDemo class. 
Class: Part 2 of PartialClassDemo
Second part of the PartialClassDemo class. 
Class: Program
Entry point for PartialClassDemo 
Office Interop 
Office Interop Code 
Access
Access 2002 Automation 
Automation (MDB)
Access 2002 Automation 
Class: Access
Access 2002 (MDB) Automation 
Example of Access Automation
Prototype of how to use Access Automation. 
WebForm: Access Form
Access Form (Prototype) 
Automation (ADP)
Access 2002 Automation 
Class: Access ADP
Access 2002 (ADP) Automation 
Example of Access ADP Automation
Prototype of how to use Access ADP Automation. 
Class: Access Form
Access Form (Prototype) 
Excel
Excel Automation 
Class: Excel Automation
Newest and most current release of the Excel Automation class 
Class: Excel Automation Update
Additional Methods and/or Properties to include in the Excel 
Automation class module. 
Outlook
Outlook 2002 Automation 
Automation
Outlook Automation 
Example of Outlook Automation
Prototype of how to use Outlook Automation. 
Class: Main Class (C# only)
Class to start C# prototype 
WebForm: Outlook AddressBook Form
Outlook AddressBook Form (Prototype) 
WebForm: Outlook Login Form
Outlook Login Form (Prototype) 
WebForm: Outlook Mail Form
Outlook Mail Form (Prototype) 
Class: Outlook
Base Class for Outlook Automation 
Class: Outlook AddressBook
Outlook AddressBook Automation 
Class: Outlook Mail
Outlook Mail Automation 
Word
Word 2002 Automation 
Class: WordAutomation
Word 2002 Automation 
Code: ActivePrinter property
Property for Word Automation class 
Code: Add, Delete, and Exist for bookmarks
Methods for automating bookmarks 
PowerPoint
Methods and properties that make it easy to start working with PowerPoint 
Class: Automation
PowerPoint Automation 
PowerPoint Example
Code to create a prototype for the PowerPoint automation 
Code: GetSlideInformation()
Function to work with the example 
Code: PowerPoint Automation Example
Code sample to illustrate properties and methods 
Class: CheckForOpenObject
Checks for an open instance of an application. 
Performance Counters 
Example code for working with the System.Diagnostics.PerformanceCounters 
classes. 
Class: EasyPerformanceCounters
This class makes it easier to work with the 
System.Diagnostics.Performance counters class 
Class: FormPerformanceCounters
Sample form to illustrate how to use the EasyPerformanceCounters class. 
Code: ShowPerformanceCounters
Shows a representative set of performance counters 
Security 
Code, tips, and techniques for creating secure applications in the .NET 
Framework. 
Cryptography
Code for encrypting and decrypting data.  
Code: Decrypt(Uses Symmetric and Asymmetric Encryption)
Example of decrypting using symmetric and asymmetric encryption. 
Code: DecryptRijndaelManagedSymmetric
Code for using the RijndaelManaged Library to decrypt data. 
Code: DecryptRSAAsymmetric
Code for using the RSACryptoService provider to decrypt data. 
Code: Encrypt(Uses Symmetric and Asymmetric Encryption)
Example of encrypting using symmetric and asymmetric encryption. 
Code: EncryptRijndaelManagedSymmetric
Code for using the RijndaelManaged Library to encrypt data. 
Code: EncryptRSAAsymmetric
Code for using the RSACryptoService provider to encrypt data.  
Code: GenerateKeysAsymmetricRSA
Code to help generate a Public - Private key pair use by 
RSACryptoServiceProvider. 
Code: ReadFile
Open the specified file and return its contents as a string. 
Code: WriteFile
Use a FileStream to write a new file. 
Timers 
Code for working with the timers in the System.Timers classes and using the 
Windows.Forms.Timer class. 
Class: FormSystemTimers
A Windows.Forms example of using System.Timer objects 
Class: FormManySystemTimers
This form contains example code that illustrates how efficient timers 
are. 
Class: FormWindowsTimer
This form contains example code that illustrates techniques for working 
with the Windows.Forms.Timer class. 
Class: FormWindowsTimerManyTimers
This form contains example code that illustrates how efficient 
Windows.Forms.Timer objects are. 
Code: HiResTimer
A high resolution timer. 
Visual Studio .NET 
HowTo: Hiding a Method from Intellisense
HowTo: Simulate the Immediate Window
Macros
Samples to show creation of Macros in Visual Studio .NET  
Code: CommentCStyle
Comments selected text using c style syntax. 
Code: UnCommentCStyle
Uncomments c-style commented code 
Code: AddTraceHooks
Adds trace hooks to any procedure currently. 
Article: Using Macros to Increase Productivity
Tip to Increase Productivity with Visual Studio Macros 
HowTo: Creating Toolbar Shortcuts to Macros 
How to create toolbar shortcuts to your macros for convenience and 
increased productivity. 
Code: InsertTraceForProc Macro
Macro code and example of using a macro to create trace statements 
for procedures. 
Code: MakeProperty Macro
Macro code and example of using a macro to create properties for 
member variables. 
Module: CollapseAllNodesCurrentlySelectedProjectsOrFolders
Collapses all of the UIHeirarchy Tree expanded items in the currently 
selected project or projects, subitems, etc.  
Module: CollapseAllNodesInSolution
Collapses all of the UIHeirarchy Tree expanded items in the solution, 
projects, subitems, etc. 
Module: OpenCurrentlySelProjControlsAndFormsAndViewTabOrd
Opens all UserControls and Forms in the currently selected project or 
projects, subitems, etc, and toggles the tab order. 
Module: OpenEntireSolutionControlsAndFormsAndViewTaborder
Opens all UserControls and Forms in the solution, projects, subitems, 
etc, and toggles the tab order. 
Module: ToggleTabOrderView
Toggles the Tab order for any object that allows it.  
Article: Creating an XSL Commenter
This article discusses creating a commenter for Extensible StyleSheet 
Language (XSL) in the Visual Studio Editor. 
HowTo: Simplify Namespace Usage
Use Imports to simplify references to classes 
Tips, Tricks, and Suggestions
Useful hints for getting started with Visual Studio .NET. 
Article: Code Comment Web Pages
Build Code Comment Web Pages. 
Article: Ctrl-Minus to Go Back
Use Ctrl-Minus to Go Back 
Article: Find Dropdown
Use the "Find" Toolbar Dropdown 
Article: Go to Definition Keyboard Shortcut
Use keyboard shortcuts, such as Go to Definition.  
Article: Keyboard Mapping Schemes
Use Keyboard Mapping Schemes 
Article: Make VS.NET Faster
Two simple tips for making Visual Studio .NET appear a bit faster. 
Article: Show Comments in the Task List
Use Comments To Flag Bugs and Undone Items 
Article: Store Code Snippets in the Toolbox
Use the Toolbox to Store Code Snippets. 
Article: Use Folders
Use Folders to Organize Complex Solutions 
Article: Use FullScreen Mode
Use FullScreen Mode to Battle Dense Code 
Article: Use high resolution and a Larger Monitor
To use the IDE to its fullest potential, consider working at a 
minimum resolution of 1280x1024, with a larger monitor 
Article: Use the Class View as a Table of Contents
Dock the Class View Window to the Left of the Code to use it as a 
Table of Contents. 
Article: Use the Keyboard for Resizing
Resize Windows Forms Controls with the Keyboard 
Article: Using Regions
Using Regions in Visual Studio .NET 
Article: View VB.NET Errors as you Type
Visual Basic .NET Shows you Errors as you Type. 
Article: Zoom HTML Windows
Zoom HTML Windows (such as VS.NET Help). 
HowTo: Run Executable Without Compiling
Add a menu item that runs the current project's executable without 
compiling. 
HowTo: Adding Default Namespaces 
Steps for using a Template file to add default namespaces. 
Web Client Side 
Code for working with client-side logic and content using web browsers. 
JavaScript
JavaScript code and samples for working in web clients and browsers. 
Snippet: Change image based on color depth
Check the browser color depth, and adjust the images accordingly. 
Snippet: Close Window with Inline Script
Close the current browser window by calling the window.close function 
inline. 
Code: getIEVersion
If the browser running Internet Explorer, returns the major version, 
otherwise returns 0. 
Code: moveToNextElement
Move focus to the next control when a control's maxlength is reached. 
Snippet: Navigate to a URL from a Button
Use a button to navigate to a URL instead of a hyperlink. 
Snippet: Navigate with inline script
Navigate to a new address with inline Javascript. 
Code: numbersOnly
Allow only numbers in a text area. 
Code: openWindow
Open a new browser window with the specified parameters 
Code: placeFocusToFirstField
Snippet: Submit a form with a hyperlink
Use a hyperlink to submit a form instead of a button. 
Snippet: Show Browser Information
Show various bits of information about the current browser 
capabilities. 
Snippet: Redirect based on browser type
Useful if your site has pages optimized for different browsers. 
Snippet: Get the browser IP address
Show the IP address in various ways 
Snippet: Display Referrer
Shows the referring page. 
Reference Material
General Reference Material for JavaScript 
Article: JavaScript Operator Reference
List of all JavaScript Operators 
Article: JavaScript Statement Reference
A list of all JavaScript statements 
General HTML Tips and Tricks
General HTML Tips and Tricks 
Snippet: Tell IE to Turn Off AutoComplete
FORM modifier to tell Internet Explorer not to use its Auto-Complete 
function. 
Snippet: Code to print the current page
Requires IE5 or later 
Snippet: Inserting Page Breaks
Example of using DHTML and styles to insert page breaks when a page 
is printed. 
Snippet: Force Browser Download
Various methods to force the browser to download a file. 
Snippet: Redirect to Download
Have a page automatically redirect to a download file 
Web Service 
Code: Consuming a Simple Web Service (Synchronously)
Consuming a Simple Web Service (Synchronously) 
Code: Consuming a Web Service (Asynchronously)
Consuming a Web Service (Asynchronously) 
Code: Consuming a Web Service over SSL
Consuming a Web Service over SSL 
Code: Consuming Overloaded Methods (Synchronously)
Consuming Overloaded Web Service Methods (Synchronously) 
Code: Consuming Web Service with Basic or Win Auth
Consuming a Web Service that requires Basic or Windows Authentication 
Module: Simple Web Service
Simple Web Service 
Module: Simulating a Slow Processing Web Service
Simulating a Slow Processing Web Service 
Module: Webservice with Overloaded Methods
Snippet: Authentication
Client-side authentication 
Windows Forms 
Code, tips and techniques for working with the .NET Windows Forms package 
Forms General
General code for working with forms 
Code: CopyPaste
Shows different ways to use the Clipboard object 
Code: CreateSubForm
Create a new form object in code, make it a child of the current 
form. 
Snippet: Create a Control Programmatically
Shows how to add a control through code. 
Code: ControlByName
This example loops through all controls in the passed form and 
returns the control that matches the passed name. 
Code: ExecutingAssemblyPath
Returns the path of the currently executing assembly 
Code: FixUpTop
Set the form to show a caption and the [X] close button, but nothing 
else. 
Code: GetScreenRes
Get the resolution of the primary monitor. 
Code: MainOneInstance
Use a mutex to allow only one instance. 
Code: OnResize
Override the resize event to do special handling 
Code: ShowFormName
Retrieve the passed form's name 
Code: SendKeys
This examples shows how to use the System.Windows.Forms.SendKeys 
object to send keystrokes. 
Class: SystemInformationForm
Example form showing the information that is returned by the 
Windows.Forms.SystemInformation class 
Code: TurnPaintingOnOff
Control screen painting using .Net methods 
Snippet: Resize a Control to Fit Text
This example code shows how to make a textbox wide enough to 
accommodate its text. 
Snippet: Working with Colors
Illustrate different methods of creating and using colors 
Code: LabelTransparent
Make a label control transparent 
Code: IterateTab
Iterate through all controls on tab pages and check the control type 
Code: Disallow Characters
Example showing how to use the KeyPress event to disallow certain 
characters from being input in a textbox 
Code: Shrink Form
Code to shrink a form for an interesting visual effect 
Forms Launching and Instancing
Code and examples for Launching and Instancing Windows Forms 
HowTo: Allowing Only One Instance of a Form
This how-to uses a Singleton pattern to ensure that only one instance 
of a form can be loaded in an application. 
Snippet: Start an Application with a Form
Start the application with a form. 
Code: PrevInstance
Returns if an instance of an application is running. 
Code: HandleFormClosing
Handle the form Closing event, and optionally cancel the close 
Cursors
Code and examples for working with cursors 
Code: ShowWaitCursor
Show or hide the wait cursor (also known as the Hourglass cursor) 
Code: ShowCustomCursor
Show a custom cursor loaded from a file 
Treeview
Code and examples for working with the Windows Forms Treeview control 
Code: AddTreeNodes
Add nodes to the treeview using two different techniques 
Code: FindNode
Search through a treeview looking for a specific tag value 
Code: ExpandNodes
Expands or collapses treenodes with display buffering for performance 
Code: LoadIconsToTreeview
Load icons from the disk into the treeview 
Code: TreeviewGetCheckedValues
Iterate through all nodes and total up checked nodes 
Code: ShowNodeCounts
Show the total node counts 
Code: CopyTreeviewNodes
Copy treeview nodes from one treeview to another 
HowTo: Treeview Drag Drop
Support drag and drop in a treeview 
HowTo: TreeViewMouseDown
Handle a Treeview Node Click 
HowTo: Treeview AutoScroll
Implement Auto-scroll in TreeView Drag Drop Operations 
Code: FormTreeViewBrowseFiles
An example of showing files and directories in a treeview control. 
Mouse Processing
Code for working with Mouse events in Windows Forms 
Code: MousePos
Get the mouse cursor position in relation to a control's boundaries. 
Code: SetMouseCursorPosition
Set the cursor position. 
Code: MouseMoveButtonState
Get the mouse button state while the mouse moves over the form. 
Code: ChangeMouseCursor
Changes the currently displayed mouse cursor and tells the system to 
ignore mouse events until the process finishes. 
Code: HideCursor
Hides the mouse cursor, pauses, then shows the mouse cursor 
Code: MouseProperties
Returns a hash table containing system information about the mouse 
Code: MoveMouse
Moves the mouse to the specified location 
Code: RestrictMouseToRectangle
Limits the area a mouse can be moved to the specified rectangle 
ListView
Code and examples for working with the Windows Forms ListView control 
Snippet: AddItemsToListView
Add items to a ListView control. 
Snippet: ClearListViewItems
Clear all items and subitems from the ListView 
Snippet: SetIcons
Add icons to ListItems already in the ListView 
Snippet: IterateItems
Iterate through all items and sub-items in the ListView and show 
their text to the output window 
Snippet: DoSimpleSort
Do a simple listview sort 
Snippet: SelectItems
Select multiple items in a listview 
Code: HandleListViewColumnClick
How to respond to a column click event 
Snippet: CountofCheckedItems
Returns a count of checked items 
Snippet: CheckClearAll
Check or uncheck all items in the ListView 
HowTo: SortListView
Shows how to implement sorting in a ListView based on clicking the 
column headers 
Code: ListViewWithTooltips
An intelligent listview that shows tooltips only when needed. 
User Controls
TextBoxPlus
Textbox with Caption with design-time support 
Class: TextBoxPlus
Class: TextBoxPlusDesigner
Designer class for the control 
Class: TextBoxPlusConverter
Type Converter for TextBox and Caption properties 
(Sub-Properties) 
Code: LabelSeparator
Creates a label with a separator line. 
AutoDrop User Control
This class makes a text box work like drop down control of IE and Explorer. 
Code: AutoDrop User Control Code
This class makes a text box work like drop down control of IE and Explorer. 
Code: Example Form for AutoDrop User Control
Example Form for AutoDrop User Control 
HowTo: Displaying Custom Control Properties
An example of how to display and categorize custom properties in the Windows Forms property window. 
GradientLabel User Control
This user control overrides a label, and allows you to fill it with a gradually changing color.  
Code: Example Form for GradientLabel User Control
Example Form for GradientLabel User Control 
Code: GradientLabel User Control
This user control overrides a label, and allows you to fill it with a gradually changing color. 
NillableDateTimePicker
This user control overrides the built-in DateTimePicker control to create a control that is Null friendly. 
Class: NillableDateTimePicker
This user control overrides the built-in DateTimePicker control to create a control that is Null friendly. 
Snippet: NillableDateTimePicker Example
Example code for using the NillableDateTimePicker control. 
KeyboardSensitiveRichTextBox
Overrides the built-in RichTextBox control to create a control that accepts keyboard shortcut keys. 
Class: KeyboardSensitiveRichTextBox
Overrides the built-in RichTextBox control to create a control that accepts keyboard shortcut keys. 
Class: KeyboardSensitiveRichTextBox Example
Example form for using the KeyboardSensitiveRichTextBox control. 
Console Window User Control
This user control can be used like the Unix Console and Visual Studio Output windows to log processes. 
Class: Console Window User Control
This user control can be used like the Unix Console and Visual Studio Output windows to log processes. 
UserControlProperties
Code and examples for customizing the way custom control properties show in the Windows Forms properties window. 
HowTo: Browsable Attribute
Use the Browsable attribute to specify whether the property shows in the Properties Window. 
HowTo: Category Attribute
Use the Category attribute to specify the name of the category in which the property should be displayed in the Properties Window. 
HowTo: Description Attribute
Use the Description attribute to specify the descriptive text that shows at the bottom of the Properties Window.  
HowTo: ParenthizePropertyName Attribute
Use the ParenthizePropertyName attribute to specify whether the property name is displayed with parentheses in the Properties Window.  
MenuButton User Control
This user control overrides the Button control to create a button with menu options. 
Code: Example Form for MenuButton User Control
Example Form for MenuButton User Control 
Code: MenuButton User Control
This user control overrides the Button control to create a button with menu options. 
ColorComboPicker User Control
Code and example for the ColorComboPicker User Control 
Code: Example Form for ColorComboPicker User Control
Example Form for ColorComboPicker User Control 
Code: ColorComboPicker User Control
This user control overrides the Combo Box control to create a color picker combo. 
ColorPicker User Control
Code and example for the ColorPicker User Control 
Code: ColorPicker User Control
This user control displays a color picker, and returns the color selected by the mouse or the keyboard. 
Code: Example Form for ColorPicker User Control
Example Form for ColorPicker User Control 
FontPicker User Control
Code and example for the FontPicker User Control 
Code: FontPicker User Control
This user control displays a font picker, and returns the font selected by the mouse or the keyboard. 
Code: Example Form for FontPicker User Control
Example Form for FontPicker User Control 
Sortable Data Grid
ASP.NET Data Grid user control that allows toggling column sort order 
by clicking on the column head, and displays an image to indicate sort 
direction. 
SortableGrid Example
Sample ASP.NET page to use the SortableGrid user control 
Class: Code Behind for default.aspx
Code Behind for default.aspx 
WebForm: default.aspx
XML: ProductDataSet.xsd
Strong-Typed DataSet 
Class: SortableGrid User Control
User Control Class 
ListBoxNoScroll
ListBox User Control that hides the vertical scroll bar 
Item: Example Form for ListBoxNoScroll
Example Form for the ListBoxNoScroll User Control 
Class: ListBoxNoScroll User Control
ListBoxNoScroll User Control Class 
Mirrored Controls
RightToLeft mirroring support for controls like Treeview, Listbox, etc. 
Class: TreeViewMirrored
For creating a mirrored RTL TreeView control 
HowTo: TreeViewMirrored (example code)
Example code for using the TreeViewMirrored control 
Grippies
User control that works like the Splitter, but expands/contracts the 
visible area when you click. 
Item: Example Form for Grippies
Example Form for the Grippies User Control 
Class: Grippies User Control
User control that works like the Splitter, but expands/contracts 
the visible area when you click. 
Web Browser Control
Code and techniques for using the Web Browser control to render HTML 
Snippet: Disable Context Menu in the Browser
Code: SetWebBrowserFooter
Example of changing IE print settings using the registry 
Code: General WebBrowser Commands
Shows how to invoke commands on the web browser control 
Common Dialogs
Examples of using Common Dialogs 
Snippet: ColorDialog
Shows how to call and use the ColorDialog 
Snippet: FontDialog
How to use the FontDialog 
Snippet: OpenFileDialog
How to implement and use the OpenFileDialog 
Snippet: PageSetup and Print Dialogs
This uses the Page Setup Dialog to set the page margins, etc., then 
pass the information to the Print Dialog. 
HowTo: SaveFileDialog
How to use the SaveFielDialog. 
Help
Illustrates how to use the methods in System.Windows.Forms.Help 
Code: ShowHelp
Opens the specified help file 
Code: ShowHelpPopup
Shows a help popup at the specified location 
ComboBox
Code for working with Combo Boxes. 
HowTo: BindComboBoxToEnum
Code for binding a combo box to an enumeration. 
Code: ComboBoxAutoComplete
Code to make a Combo Box Control Autocomplete as you type.  
Code: ComboBoxUpdate
Code to update a combo box's data source, then refresh the combo box to show the new item. 
Article: ComboBox Data Binding and Case Sensitivity
Tip regarding ComboBox Data Binding and Case Sensitivity 
Controls
Code for working with Controls.  
Article: Avoiding Unwanted Events from Controls
Avoid unwanted events from ComboBoxes and other Controls in VB .NET 
ListBox
Code for working with the ListBox Control 
HowTo: ListBoxExtend
Extending the ListBox Control with Custom Data 
Threading
How-to's and example code for threading and Windows Forms. 
HowTo: Multi-Threading in Windows Forms
Notes and Examples for using Multiple Threads with Windows Forms. 
HoverBalloon Tooltip Control
This class creates a balloon tooltip on a Windows form. 
Code: Example Form for HoverBalloon Tooltip
Example form showing how to implement the HoverBalloon Tooltip code. 
Code: HoverBalloon Tooltip Code
This class creates a balloon tooltip on a Windows form. 
EditTip Balloon Tooltip
Code and example to create a balloon tooltip that it is triggered 
when the user enters an invalid character in the text box. 
Code: EditTip Balloon Tooltip Code
Creates a balloon tooltip that it is triggered when the user 
enters an invalid character in the text box. 
Code: Example Form for EditTip Balloon Tooltip
Example form showing how to implement the EditTip Balloon Tooltip 
code. 
MessageTip Balloon Tooltip
Code and example to create a balloon tooltip with customizable 
balloon position, stem position, and alignment.  
Code: Example Form for EditTip Balloon Tooltip
Example form showing how to implement the MessageTip Balloon 
Tooltip code. 
Code: MessageTip Balloon Tooltip Code
Creates a balloon tooltip with customizable balloon position, 
stem position, and alignment. 
Splash Screen
Code and Examples for creating a splash screen for your Windows application. 
Splash Screen Demo
A simple WinForm app to use the SplashScreen object. 
Code: MainForm
An example main form to use in the splash screen demo. 
Code: SplashForm
An example splash screen form to use in the splash screen demo. 
Code: SplashScreen
Base Class, to be inherited by user's own Splash Screen WinForm. 
Class: SplashScreenHelper
Helper class to manage the Splash Screen object. 
SendSMTPMail
Code and Examples for sending SMTP Mail through WinForms 
Class: SendSMTPMail
Code for sending Email through an SMTP Server. 
HowTo: SendSMTPMail Sample
Sample form showing how to use the SendSMTPMail Class. 
RichTextBox
A collection of helper code for the RichTextBox control 
Code: RTBPasteImage
Insert an image into the specified RichTextBox control at the current 
cursor position 
Code: RTBSetFontFamily
Set the font family of the currently selected text in a RichTextBox 
control 
Code: RTBSetFontSize
Set the font size of the currently selected text in a RichTextBox 
control 
HowTo: SaveImageToFile
Sample code that shows how to save an image to a file with a variety of 
options 
Article: Visual Inheritence
Article and Code for using Visual Inheritance and the WinForms Designer 
SetButtonStyle
Code to iterate through the buttons on forms and set the style of each 
button 
XML: SetButtonStyle.exe.manifest
Code to iterate through the buttons on forms and set the style of 
each button. 
Item: Example Form for SetButtonStyle
Example form for the SetButtonStyle class 
Class: SetButtonStyle Class
Code to iterate through the buttons on forms and set the style of 
each button. 
ModifiedEventHook
Code to hook into the events of all handled controls on your form to tell 
you if and when a user modifies a value. 
Class: ModifiedEventHook Class
Code to hook into the events of all handled controls on your form to 
tell you if and when a user modifies a value. 
Item: ModifiedEventHook Example Form
Example form for the ModifiedEventHook class 
Browse for Folder
Code and example for opening a Browse for Folder dialog with .NET version 
1.0 
Code: BrowseForFolder
Code to open a Browse for Folder dialog with .NET 1.0 
HowTo: BrowseForFolder Example
Example form for using the Browse for Folder code in .NET 1.0 
DataGrid
Code and examples for working with the Windows Forms DataGrid control 
HowTo: Binding a DataGrid to an Array
This example shows the basic techniques of binding a Windows Forms 
DataGrid control to an Array.  
HowTo: Binding a DataGrid to SQL Server
Basic techniques of binding a Windows Forms DataGrid control to a 
data source in Microsoft SQL Server. 
Code: Column Header Double Click
How to test for a double click event on the DataGrid column header 
Code: Datagrid Cell Readonly
Code that shows how to make a particular cell in a Datagrid readonly 
Code: DataGrid Column Hide
Code to hide a column in a DataGrid 
HowTo: DataGrid Conditional Cell Color
Code that shows how to change the background color of a DataGrid cell 
based on its value 
Code: Disable New Row
Disable the NewRow function on a DataGrid 
Code: Get Click Context
Use the MouseUp event and the HitTestInfo object to get the text of a 
cell or column header when it is clicked on. 
Code: Highlight Entire Row
Code to highlight an entire row when the user clicks on a cell 
Code: Number Only Datagrid Cell
Example code showing how to limit Datagrid cell input to only numb ers
ProcessKeyPreview
Shows how to override a form's (or a usercontrol's) ProcessKeyPreview 
handler to process the keystroke message directly. 
Item: ProcessKeyPreview
Shows how to override a form's (or a usercontrol's) ProcessKeyPreview 
handler to process the keystroke message directly.  
Snippet: SingleInstanceApp
Code to create a single instance application. 
Picture Box
Code, tips, and techniques for working with the Picture Box control. 
Drag and Drop
Example of how to drag & drop an image between 2 picture boxes. 
Item: Drag and Drop
Example of how to drag & drop an image between 2 picture boxes. 
RadioButton
Code for working with Radio Buttons 
Item: Get RadioButton Selection
Example of Acquiring User's Radio Button Selection 
Text Box Validation Provider
Using Extender Providers to extend the text box control for automatic 
validation (for numbers, dates, currency, phone numbers, etc.) 
Item: Example Form for Text Box Validation Provider
Example Form for the Text Box Validation Provider Control 
Class: Text Box Validation Provider Control
Text Box Validation Provider Control Class 
Windows Management Interface and OS 
Domains, Groups and Users
Win32 Accounts
Code and examples for working with Windows Accounts through WMI. 
Code: GetAllAccountNamesInDomain
Code: GetAllAccountPropertiesAvailable
Win32 Groups
Code and examples for working with Windows Groups through WMI. 
Code: GetAllGroupsInDomain
Code: GetGroupPropertiesAvailable
Win32 System Accounts
Code and examples for working with Windows system accounts 
through WMI. 
Code: GetSystemAccountPropertiesAvailable
Win32 User Accounts
Code and examples for working with Windows accounts through WMI. 
Code: GetUserAccountPropertiesAvailable
Environment Info
Functions for returning information about the environment the program is 
being run in 
Environment Variables
Code: GetAllEnvironmentVariables
Code: GetSpecificEnvironmentVariable
Gets the specific Environment Variable and returns it. 
Special Folders
Code: GetAllSpecialFolders
Retrieves all the special folders on the system 
Code: GetSpecificSpecialFolder
Returns the path of a Special Environment Folder 
HowTo: Complete WMI Object Class creation
Describes how to create a class for a WMI Object. 
Windows Services 
A complete sample project or template that shows how to create and use a .NET 
service application. 
ServiceTemplate
Components to create setup and uninstall programs, as well as the code to 
create the service itself. 
XML: App.config
Code: Installer
Item: InstallService.bat
Code: Service
Code: ServiceMain
Item: UninstallService.bat
TestAppTemplate
A sample form to display how the Service works.  
XML: App.config
Code: Entry
Code: frmTest
Process Template
Code to create a background service to handle multithreading, and code to 
store configuration values in an XML file. 
Code: ServiceConfig
Code: ServiceDispatch
ServerControllerTemplate
Application that controls the service. 
XML: App.config
Code: Entry
Code: frmServiceController
Code: ServiceManager
XML 
Item: authors.xml
Item: authors.xsl
Snippet: Select From SQL Server using a URL and XML
Select From SQL Server using a URL and XML 
Snippet: Web Form Transform Example
Web Form Transform Example 
Code: XMLCSS
This example shows a modified version of the authors.xml file found in 
XML\Sample Data 
Code: XMLRead
Sample code illustrating how to read an xml file from disk or URL.  
Code: XMLTransformFile
Transforms specified xml file using specified xsl file and returns the 
resulting file's contents. 
Code: XMLTransformToFile
Transforms specified xml file to dest file using the xsl file specified. 
Code: XMLWrite
Simple example of writing data to an xml file. 
Class: XML Wrapper Class
Simple wrapper class for getting data out of XML. 
Convert XML file to CSV file (Part 1)
Code and example of how to use an XSL file to convert an XML file to CSV. 
XML: Convert XML file to CSV file
XSL file to simplify converting an XML file to a CSV file (csv_Attributes.xsl) 
XML: Sample XML Data
Sample XML data for Converting XML file to CSV file. Data is represented as Attributes. 
Convert XML file to CSV file (Part 2)
Code and example of how to use an XSL file to convert an XML file to CSV. 
XML: Convert XML file to CSV file
XSL file to simplify converting an XML file to a CSV file (csv_Elements.xsl) 
XML: Sample XML Data
Sample XML data for Converting XML file to CSV file. Data is represented as Attributes. 
		   |