Tag Archives: .NET

A Word Search Tool for Creating and Solving Puzzles

crossword
Crossword

I wrote a little tool today that others may find useful. This tool allows you to load a list of words (could be a big list, like a dictionary), and then search it using a regular expression. I needed it to help me create some puzzles (letterfind, swedish and crossword styles).

The program was written in C# and requires .NET 2.0 on your machine. It comes with two sample word lists: one with almost a million words from the Portuguese language, and one with 50 names of trees in Portuguese (of course the program can handle words in different languages!).

Be sure that your wordlists are plaintext with one word per line, and in UTF-8 format, e.g.:

desk
computer
mouse
blackboard

See the included word lists for samples. The alphabetic order in the file doesn’t matter. The program will ignore diacriticts in its searches (i.e. acção = accao). You can use wildcards like % and . in your searches:

  • %cao” returns everything that ends in “cao” (or ção, since diacritics are ignored)
  • “a..ba” returns everything that starts with “a”, then two random letters, and ends with “ba”
  • The query “….” returns all four-letter words.

Here’s the tool for download: Dict.zip (2.1 MB).

If you don’t have the .NET framework installed, you can get version 2.0 here (higher versions will also work – I tried to keep the requirements low).

As a bonus: this (PDF, 286 KB)  is something that was made using with gathered using this tool.

Expandable Properties in Visual Studio .NET

I had written a control with a number of properties, most of which showed up automatically in the Visual Studio Properties window. Simple data types were not a problem, nor were arrays: Visual Studio automatically opens up a window that lets the user edit the array elements. However, class or structure instances were not editable out of the box: they were shown grey-out in the Properties window.

The solution to this lies in that Visual Studio needs to know how the subclass or subproperty should be edited. An example of this is the Padding property that all controls share: it’s a structure with a couple of properties (Left, Right, Bottom, Top and All), and in the Properties window you can expand the Padding property so you can edit any of these properties individually. This is precisely what I wanted for my substructures.

It’s easy to convince Visual Studio .NET to give you this behavior by adding a TypeConverter attribute to your structure, like so:

[TypeConverter(typeof(ExpandableObjectConverter))]
public struct MyStruct
{
  ...
}

ExpandableObjectConverter is already implemented for you, as are some others. If you want different behavior in the Properties window, you can implement your own TypeConverter.