Monthly Archives: October 2012

Use a for loop to recursively iterate over the items in an array with an unknown number of dimensions in C#

When it starts, the program executes the following code. private void Form1_Load(object sender, EventArgs e) { string[, ,] values = { { { “(0, 0, 0)”, “(0, 0, 1)”, “(0, 0, 2)”, “(0, 0, 3)”, }, { “(0, 1, 0)”, … Continue reading

Posted in algorithms, arrays, syntax | 2 Comments

Make an extender provider that makes it easy to preview TextBox changes in C#

The last few posts explained how to preview changes to a TextBox and ensure that the user could only enter an integer or a floating point value. Those examples demonstrated a basic technique but were hard-wired to specific TextBoxes so … Continue reading

Posted in controls, user interface | Leave a comment

Make a TextBox that lets the user only enter floats in C#

The posts Make a TextBox let the user enter only integers in C# and Make a TextBox let the user enter only integers in C#, Part 2 show how you can make a TextBox accept only integers. This example is … Continue reading

Posted in controls | Leave a comment

Make a TextBox that lets you preview and cancel changes to its text in C#, Part 2

Part 1 of this post explained how the example previews changes made by keyboard events. It then accepts or cancels the changes depending on whether the TextBox’s new value is a valid integer (or the start of one as in … Continue reading

Posted in controls | Leave a comment

Solution: Zero rows and columns in an array in C#

This post gives four solutions to Puzzle: Zero rows and columns in an array in C#. If you want to try the puzzle for yourself, see that post before you read this one. This is a fairly long post but … Continue reading

Posted in arrays, games | 3 Comments