Author Archives: RodStephens

About RodStephens

Rod Stephens is a software consultant and author who has written more than 30 books and 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java.

Copy ListView data into an array in C#

This example uses the following ListView extension method to copy ListView data into a two-dimensional array of strings. // Return the ListBox’s contents in a string[,]. public static string[,] GetListViewData(this ListView lvw) { // Get the number of rows and … Continue reading

Posted in arrays, controls, strings | Tagged , , , , , , , , , , | Leave a comment

Draw the spiral of Theodorus in C#

The spiral of Theodorus (which is also called the square root spiral, Einstein spiral, and Pythagorean spiral) was first devised by the Greek mathematician Theodorus of Cyrene during the 5th century BC. The spiral consists of a sequence of right … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , | Leave a comment

Build an MRU list that uses project settings in C#

The post Build an MRU list in C# explains how to build an MRU list (most recently used list). That example stores recently used files in the system Registry. This example does the same thing but it stores file information … Continue reading

Posted in files, programs, registry | Tagged , , , , , , , , , , , , , | Leave a comment

Tile a bitmap with a string in C#

I recently needed a bitmap tiled with a string for a book I’m working on, so I wrote this program to make it. The program lets you click on the font name, dimensions, or colors to select those values. When … Continue reading

Posted in algorithms, graphics, image processing | Tagged , , , , , , , , , , | Leave a comment

Color the solutions to the “Find the squares in C#” puzzle

The post Solve the “Find the squares in C#” puzzle explained how you can find solutions to the puzzle described in the post Puzzle: Find the squares in C#. This example shows how you can color the solutions so squares … Continue reading

Posted in algorithms, games, graphics, mathematics | Tagged , , , , , , , , , , , | Leave a comment

Save WriteableBitmap images in multiple formats in WPF and C#

The post Easily save a WriteableBitmap in WPF and C# describes an extension method that makes it easy to save a WriteableBitmap object into a PNG file, but what if you want to save the image in some other format … Continue reading

Posted in extension methods, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Display team names for a round robin tournament in C#

The example Generate a schedule for a round robin tournament in C# explains how you can generate a schedule for a round robin tournament. This example simply adds the ability to display the schedule using the team names instead of … Continue reading

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

Use a password protected Access database in C#

This example shows how you can open and use a password protected Access database in C#. It also shows how you can use the database’s password protection to provide a login form for your program. Note that the security used … Continue reading

Posted in database, Office | Tagged , , , , , , , , , | Leave a comment

Generate a random password in C#

As I mentioned in a recent post, you should always use a strong password for every login. Remember, a computer can perform millions or billions of operations per second, so your daughter’s birthday or the name of your son’s guinea … Continue reading

Posted in algorithms, cryptography, internet | Tagged , , , , , , , , , | Leave a comment

Why Twitter recently wanted you to change your password

A few days ago, Twitter asked all of its users to change their passwords. The reason they did that was that they found a bug in their system that made an internal log file store passwords in an unencrypted form. … Continue reading

Posted in cryptography, internet, miscellany | Tagged , , , , , , , , , , , | Leave a comment