Library code snippets tagged with c#
-
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.
-
Calculate Age
by James Crowley
How to calculate someone's age from their birth date.
-
Save a Stream to a File
by James Crowley
Demonstrates how to write a stream to a file.
-
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.
-
Modify a Window's System Menu
by Steven Cohn
How to add an additional menu item to a windows system menu.
-
Asynchronous HttpWebRequest
by Steven Cohn
Demonstrates how to build a much more responsive and user-friendly application by using asynchronous HttpWebRequests.
-
Validating an Integer
by Simon Soanes
How to validate an Integer the fast/efficient way in C# using Double.TryParse()
-
Custom Word Wrapper
by David Cumps
A nice little class that takes some text, and will automatically wrap it according to a specified width.
-
IE Browser Helper Objects
by Steven Cohn
A demonstration of how to implement an IE Browser Helper Object in C#
-
Create Hashes - MD5, SHA1, SHA256, SHA384, SHA512
by David Cumps
In PHP its a simple task to generate hashes, but in C# it takes a little more work. We'll create a Hash class to simplify the process.
-
RSS Feed Helper Class
by James Crowley
A simple helper class to make generating an RSS feed a piece of cake - its the one we use on Developer Fusion too!
-
UI Threading Helper Classes
by Roy Osherove
One of the most cumbersome things you will ever have to do with Winforms is updating your User interface while receiving events from another thread. These helper classes make it a breeze.
-
Executing a .CS file
by David Cumps
Demonstrates how to write a C# program that can "launch" a .cs file and execute it.
-
Associating your program with every file
by David Cumps
Learn how to add a program to the shell right click menu for every file.
-
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
-
I need a time-out!
by Wouter van Vugt
I need a time-out! Or more specifically, my methods need a time-out mechanism. And because I spent seven projects and quite some time on the web trying to find out how to do it correctly, I am writing this small article about the works.
-
Complex Data Binding
by Dan Glass
Complex Data Binding a collection implementing IBindingList and ITypedList
-
System Menu Classes
by Michael H
Two classes that provide system menu functionality similar to the regular Menu and MenuItem classes so that you can use regular Click events instead of overriding WndProc.
-
XML/XSD Schema Validator
by joe miguel
To teach how to write XML and Schemas (or DTD's). Some of the schemas language can be difficult to understand. I needed an easy (and free) way to know if my work was correct, if not then exactly what was wrong with it. As implied above, this example will also show you how to use schemas in your own programs.
-
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.