C# Sample Code
-
How to simulate a status bar in a Web application
by Edward Tanguay
If you have a process that takes over 20 seconds or so on a Web application, you may want to let the user know the status of the process. Edward shows you how.
-
A shell for Google's image search
by Michael H
A program that searches on Google's Image Search.
-
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.
-
How to create PDF files from ASP.NET pages
by Edward Tanguay
How to create PDF files from ASP.NET pages with Crystal Reports without using Visual Studio.NET
-
Pinging a host from VB .net
by MstrControl
A class that allows ping a computer.
-
Image to HTML
by Michael H
A simple program that converts images into blocks of font tag colored 1s and 0s.
-
An AutoRedraw Property
by Michael H
A simple AutoRedraw property to fool around with.
-
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
-
How to display a date in a specific language
by Edward Tanguay
How to convert a date and display it in the correct format for a given language.
-
Convert an array to a comma-delimited string
by Edward Tanguay
How to convert an array into a comma-delimited string with String.Join
-
Adding controls to PlaceHolders dynamically
by Edward Tanguay
A simple example demonstrating how to dynamically add controls to a PlaceHolder control.
-
How to get an array of all files in a directory
by Edward Tanguay
This simple code will give you an array containing all files in a directory.
-
Creating a dynamic graphic which returns a .jpg
by Edward Tanguay
This code allows an .aspx file to receive parameters (file name and width of picture) and return a JPEG resized to the requested width.
-
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.
-
System Menu Items
by Michael H
How to add menu's to the system menu and respond to clicks.
-
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.
-
XML Node Insert
by Paul Parks
Someone recently asked on the Undernet #C# channel for help with inserting a block of XML into an existing XML document. After perusing a couple of MSDN articles here's what I came up with.
-
How to write an ASHX file
by Edward Tanguay
An example of using a web handler file which you can use when your output is not going to a browser but to an xml-consuming client of some kind, keeping you away from all the browser technology you don't need.
-
Getting Started With C#
by Bill Burris
This example is to get you started using C# in Visual Studio.NET. It is intended to be used as your first program to test your Visual Studio .NET installation, and to start finding your way around in VS
-
Encoding your script files
by ElementK Journals
Protect both your server-side and client-side scripting by using the MS encoding utility