Sample Code
-
Random Numbers... That Work!
by Karl Moore
Has all this talk about seeds got you confused? Here's a nice snippet to show you the best way to get random numbers in .NET.
-
How to access a MySQL database with .NET
by Edward Tanguay
Demonstrates how to connect to a MySQL database with C#.
-
Automatically check/uncheck multiple checkboxes
by Kiran Pai
Allow a user to easily uncheck and check all the checkboxes on a form
-
Excel worksheet search/find function
by Per A. Bergersen
Having problems with finding the right worksheet? This code makes it easier find what you are looking for. The search criteria is the worksheet names that is put into a combobox automatically. when clicking on the name or writing it, the worksheet with that name appears.
-
"On Error Resume Next" considered harmful
by Palo Mraz
Discusses some unexpected implications of using the 'On Error Resume Next' statement in Visual Basic applications.
-
Double buffering in .NET
by Simon Soanes
Ever wondered how to double buffer with a Graphics object so your GDI+ based game/control doesn't flicker annoyingly? Here's how!
-
Remove the selected items in a ListBox
by Kym Manson
How to remove the selected items in a listbox
-
Binding a Control to an Enum
by James Crowley
Ever had an Enum (with a set of names and values) that you wanted to bind to a control like a DropDownList? Here's how.
-
Browse For Folder VBA
by Mike J
Demonstrates how to display a Browser For Folder dialog. Please note that this source sample is for VBA only. Not VB.
-
WinZip Command Line Information
by Mike J
Winzips description to how to use VB with Winzip from the command line
-
Set the target frame of a form
by Kiran Pai
How to make the output of a form appear in a new window or another frame
-
Capture Video
by Alex
A simple piece of code that can capture live video from a web cam.
-
Binding Multiple Fields to ASP.NET ListControl classes
by Neil Dodson
Out of the box, the ASP.NET list controls (CheckBoxList, RadioButtonList, DropDownList) only support data binding on a single field. Learn how to work around this to bind to as many fields as you need.
-
Embed text in Image using ASP.NET
by Julian Roberts
Demonstrates how to dynamically embed a text caption embedded into an image.
-
Parse a UK Date String
by James Crowley
Ever wondered why DateTime.Parse doesn't recognise non-US date format? Here's how to get it to!
-
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.
-
Compact & repair MS Access database
by Mike J
Simple snippet of code to compact and repair any MS Access database.
-
Storing / Retrieving pictures from database
by Imthiaz Rafiq
This sample code demonstrates how to save and retrieve pictures from a database using PHP.
-
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.
-
Common Dialog Example
by James Crowley
How to show the Open, Save, Select Color and Print common dialogs.