Monthly Archives: May 2017

Understand probabilities of unrelated events (and escaping zombies)

Given some event with a relatively low probability, what is the probability that the event will occur if you perform many trials? For example, suppose the zombie apocalypse has arrived and there’s a 1% chance that the zombies will get … Continue reading

Posted in mathematics | Tagged , , , , , , , , , | Leave a comment

Display reusable dialog forms in C#

The example Make a dialog with standard dialog features in C# shows the most common approach to making dialogs. Whenever it needs to display the dialog, the main program initializes a new instance of it and displays it. If the … Continue reading

Posted in dialogs, user interface | Tagged , , , , , , , , , , , | Leave a comment

Make a TextBox with auto-complete in C#

It’s not too hard to make a TextBox provide an auto-complete feature. In fact, the TextBox control offers three auto-complete styles. This example demonstrates those styles. To provide auto-complete, you need to set the following three TextBox properties. AutoCompleteMode – … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | Leave a comment

Compare the performance of the int, long, and byte data types in C#

The example Compare the performance of the float, double, and decimal data types in C# compares the performance of the float, double, and decimal data types. This example performs a similar test for the int, long, and byte data types. … Continue reading

Posted in performance, variables | Tagged , , , , , , , , , , , | Leave a comment

Compare the performance of the float, double, and decimal data types in C#

A computer’s math coprocessor typically gives the best performance with a particular data type. To see which works best on my system and to learn how big the difference is, I wrote this program to compare the performance of calculations … Continue reading

Posted in performance, variables | Tagged , , , , , , , , , , | 6 Comments

Save several images into Access in C#

The example Save images in an Access database in C# includes an Access database. Unfortunately if you save several images into the database and then open the database in Access, Access removes the images. It just doesn’t seem to understand … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find .NET libraries for namespaces in C#

Some namespaces have names that nicely match their .NET libraries. For example, the System.Drawing namespace is defined in the System.Drawing library. Unfortunately a namespace’s name doesn’t always match the name of the .NET library that defines it. For example, the … Continue reading

Posted in .NET, miscellany | Tagged , , , , , , , , | Leave a comment

Load images from an Access database in C#

The post Save images in an Access database in C# explains how to save images in an Access database. This post explains how to load images from an Access display them. Like previous examples, this program uses a SQL statement … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

Save images in an Access database in C#

This example shows how you can save images in an Access database. The example Use filenames stored in a database to display images in C# shows how to display images by saving the image file names in a database and … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , , , , , , , , | 4 Comments

Use the Filter property to select image files in C#

This example is mostly intended to make it easier to find these filters. I use them a lot and it’s a pain to have to recreate them every time I need them. When you click the Different Types button, the … Continue reading

Posted in controls, dialogs, image processing | Tagged , , , , , , , , , , , , , , , , | Leave a comment