.NET Sample Code
-
How to convert a string to a date
by Edward Tanguay
Finding out how to convert one type to another in .NET is tricky. Here is the answer to converting a string to a DateTime type.
-
How to get the current SessionID
by Edward Tanguay
Demonstrates how to retrieve the current SessionID for storing session data in a database
-
Making a .NET app run on Vista with Administrator priviledges
by James Crowley
If you're targeting Windows Vista and your application requires administrator priviledges (such as accessing the program files directory), then it will fail unless you include a manifest so Windows knows. Here's how.
-
Asynchronous HttpWebRequest
by Steven Cohn
Demonstrates how to build a much more responsive and user-friendly application by using asynchronous HttpWebRequests.
-
Adding controls to PlaceHolders dynamically
by Edward Tanguay
A simple example demonstrating how to dynamically add controls to a PlaceHolder control.
-
Merge an .exe and a .dll into one .exe
by Edward Tanguay
How to merge an .exe and a .dll into one .exe using ilmerge in VS.NET
-
Programatically Load User Controls
by Dave Wanta
How to programatically load user-controls from code behind pages and then access their properties using reflection.
-
How to check to make sure a URL is valid
by Edward Tanguay
A neat bit of code that checks if a domain is valid and actually exists.
-
Generate PDFs using C# and the free iTextSharp library
by James Crowley
Learn how to use the free iTextSharp library to load a PDF form, populate some dynamic fields, and then save out a flat PDF file.
-
User-Friendly Validation using ErrorProvider
by Tim Dawson
Data entry is a very important part of a lot of applications. It is important to validate data as it is entered without disturbing the user. Enter the ErrorProvider component.
-
Customize XML Serialization using IXmlSerializable
by James Crowley
Learn how to implement the IXmlSerializable in order to customize serialization of your objects - for instance, serializing a NameValueCollection.
-
Deep clone an object in .NET
by James Crowley
A simple code snippet that deep-copies an object by serializing and de-serializing using the BinaryFormatter
-
Read MP3 Tag Information (ID3v1 and ID3v2)
by Erin Jones
This sample source code demonstrates how to read IP3v1 and IP3v2 tag information from MP3's, along with MPEG headers too.
-
Create Controls At Runtime
by Colin Harman MACITP
Shows how to create controls at runtime and set their properties
-
Placing results from DataReader into an Array
by Edward Tanguay
Since a connection cannot be used until a DataReader has been closed, it is quite often necessary to read the results of a DataReader into an array, then close the DataReader, then you can process the data in the array while you use the connection for something else. This shows you how.
-
Start a Process as a Different User
by Peter Rekdal Sunde
This tutorial will help you learn how to start a process as another user e.g. the Administrator account.
-
Validating an Integer
by Simon Soanes
How to validate an Integer the fast/efficient way in C# using Double.TryParse()
-
Generate an Image of a Web Page
by Alan Dean
Demonstrates how to fetch images and thumbnails of web pages using a hidden web browser control.
-
Is an Internet Connection Available?
by Karl Moore
Check if an internet connection is available using this simple code snippet.
-
FTP client library for C#
by Dan Glass
An FTP client library for C#, including asynchronous operation