.NET Sample Code
-
How Big is that File – in English?
by Karl Moore
Not everyone wants to convert 2147483648 to 2 GB in their head every time we want to know how big a file is. Here's an easier way.
-
The Trick to Temporary Files
by Karl Moore
Karl Moore reveals how to save temporary files in... the temp directory!
-
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
-
Is an Internet Connection Available?
by Karl Moore
Check if an internet connection is available using this simple code snippet.
-
Add your Web Link to the Favorites!
by Karl Moore
Ever wondered how to add a internet link to Internet Explorer's Favourites from your app? Here's how!
-
Converting HTML to Text
by Karl Moore
Demonstrates how to use a simple regular expression to remove all HTML tags from text
-
ASP.NET Graphical Page Hit Counter
by Raam Kumar
Generate graphics on the fly to provide a graphical page hit counter, storing the counter in a text file or SQL database.
-
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.
-
XBrowse
by J P
XBrowse is a small application that allows the user to view and edit XML files as well as extract XSD schema files from the XML document. It is overall a pretty simple program that is based off of a code snippet in the VS.Net IDE.
-
clsFolderBrowser
by MstrControl
Implements the SHBrowsrForFolder capability on a .NET environment.
-
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.
-
Display SQL Server table data in a browser
by Edward Tanguay
Just supply your database connection string and this code will give you a radio button list of all your SQL Server tables and will show their fields.
-
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.
-
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 to an XML file
by Edward Tanguay
Writing to XML files is quite easy in ASP.NET as there are so many objects prepared for you -- you just need the syntax on how to use them. This code shows you how to write a simple member XML file.