.NET Sample Code
-
How to run through multiple DataReader results
by Edward Tanguay
You can save code by piling SQL statements into one SqlCommand and then getting a DataReader with multiple result sets.
-
Easy Asynchronous Programming
by Simon Soanes
A simple demonstration of how to use multithreading and delegates in .NET to execute a method that will take a long time, without locking up our main thread.
-
Are You Running in the IDE?
by Karl Moore
Here's how to detect if your .NET code is currently being debugged, or if we're in design mode.
-
How to get information about the current browser
by Edward Tanguay
This code shows you how ASP.NET simplifies information about the current browser into class properites. There are others but these are the most useful.
-
Data Entry Validation with Error Provider
by Colin Harman MACITP
This example code uses the errorProvider control which ships with c# to validate data entry and shows the error icon if validation is not correct
-
Sending Authenticated Emails in .NET 2.0
by Xavier Larrea
Learn what's changed with .NET 2.0 and how to send out emails using an SMTP server that requires authentication.
-
Applying XSL transformations to XML in .NET
by Krishnan
A simple demonstration of how to apply an XSL transformation to an XML file and save the output using .NET
-
How to empty a recycle bin
by Peter Rekdal Sunde
Here is a little snippet that allows you to clean your recycle bin without any confirmation from the user, no progress ui and the sound is removed.
-
A shell for Google's image search
by Michael H
A program that searches on Google's Image Search.
-
GDI+ Image Encoder and Decoder Info
by Mitch ★
Sample code to display useful information about the built in GDI+ Image Encoders and Decoders. Easily used to display information about any Encoder and Decoder as well.
-
Dynamically loading an IBindableTemplate
by James Crowley
Demonstrates how to dynamically load an IBindableTemplate from a file for use with new ASP.NET 2.0 controls such as the FormView, to workaround the lack of a LoadBindableTemplate method in the new version of the framework.
-
How to measure how long a task takes
by Edward Tanguay
If you want to compare the performance of two processes, you can use this code to measure and print out the time takes by each process
-
Simple Object Relation Mapping with Reflection
by Simon Soanes
This is some code I wrote a little while back as an example O/R mapper.
-
Windows Forms and the Idle Loop
by Mike Taulty
When you're writing Windows Forms applications it's always nice to be able to keep the UI responsive in order to avoid frustrating the user. Here's a method of completing your asynchronous work on the Application Idle loop rather than allowing another thread to wander into your Windows Forms code and then trying to deal with it by Control.Invoke.
-
VB.NET Stylise Your Forms like you would with CSS on a webpage
by phill
How to Programatically change properties of all the controls on your form.
-
C# WebCam Service with FTP and Installer
by Dan Glass
A C# WebCam Windows Service demonstrating FTP upload, Windows Service Installer, and file rotation.
-
A convenient wrapper class to get file info
by Edward Tanguay
A simple wrapper class to combine the information contained in the .NET File and FileInfo classes.
-
Transactions made easy with .NET 2.0
by Xavier Larrea
One of the more significant improvement in .NET 2.0 is the transactions area. Now with a single line it becomes extremely easy to support transactional code blocks using the concept of “ambient” transaction thanks to TransactionScope in the System.Transactions namespace.
-
Developing your first Visual WebGui application
by Guy Peled
An introduction to Visual WebGui through a sample application.
-
Storing Documents with MS Access - SharePoint lists or Access BLOB fields
by Sean Brady
This is an Access 2003 project file that demonstrates how to do a few cool things with documents. You can grab the project file (zipped) from here: http://www.guardianbob.com/support/public_files/DocumentStorageTest.zip This project will show you how to store and retrieve documents from both an Access table with a BLOB field as well as a SharePoint list (via linked tables and the list web service).