Monthly Archives: June 2012

Display images with file names stored in a database without data binding in C#

The reason so many people ask how to store and retrieve images in a database is that it’s hard. You need to use a special data type such as a BLOB (Binary Large Object) or MEMO data type depending on … Continue reading

Posted in database, graphics | 1 Comment

Display information about database records selected from a list without data binding in C#

The example Initialize a list from a database table without data binding in C# explains one way to fetch values from a database table and use them to initialize a ListBox. This example extends that one to display information about … Continue reading

Posted in database | Leave a comment

Initialize a list from a database table without data binding in C#

(Note that this is a very manual way to do this. Often you can display data more easily by using data binding.) In this example, I added the Access database file Books.mdb to the project and set its “Copy to … Continue reading

Posted in database | Leave a comment

Use the yield statement to make an enumeration in C#

An enumeration is a sequence of values that a program can enumerate over, for example, by using a foreach loop. In C# you can use the yield statement to make a method that returns an enumeration. The method should return … Continue reading

Posted in algorithms, mathematics | Leave a comment

Compare sorting algorithms in C#, article 5 of 5

Countingsort The discussion of Quicksort in my previous post mentions that the fastest possible sorting algorithms that use comparisons use on the order of N * log(N) steps. Countingsort does not use comparisons so it is not bound by that … Continue reading

Posted in algorithms | Leave a comment

Compare sorting algorithms in C#, article 4 of 5

Quicksort Quicksort is a recursive algorithm that uses a divide-and-conquer technique. While the list of items to be sorted contains at least two items, Quicksort divides it into two sublists and recursively calls itself to sort the sublists. The Quicksort … Continue reading

Posted in algorithms | Leave a comment

Compare sorting algorithms in C#, article 3 of 5

Selectionsort Selectionsort is a very simple algorithm. First you search the list for the smallest item. Then you swap that item with the item at the top of the list. Next you find the second smallest item and swap it … Continue reading

Posted in algorithms | Leave a comment

Compare sorting algorithms in C#, article 2 of 5

Bubblesort Bubblesort is a specialized algorithm designed for sorting items that are already mostly in sorted order. If only one or two items in your list are out of order, Bubblesort is very fast. If the items in your list … Continue reading

Posted in algorithms | Leave a comment

Compare sorting algorithms in C#, article 1 of 5

I’m going to be off the grid for a while so I’m posting a series of articles about sorting algorithms. Much of the text originally appeared in the December 1995 issue of Visual Basic Developer magazine, a publication that seems … Continue reading

Posted in algorithms | 6 Comments

Understand how and why a form resizes when its font resizes in C#

With an aging user population, you may want to allow users to increase a form’s font size so they can see it more easily. If you change the form’s font size, however, things won’t fit any more. To make this … Continue reading

Posted in fonts, forms, graphics | 1 Comment