Sudoku in Visual Basic .NET

I found an interesting little program that creates Sudoku puzzles in Visual Basic .NET. I have to say that I really love it. But not for the reasons one might expect. I don't love it for the amount of cool features it has. Frankly it doesn't have all the bells and whistles that a lot of Sudoku programs I have seen do have. That is, paradoxically, why I love it. If you are looking for something fun to play with, uh, I mean work with and learn from, over the holiday break this may be just the thing.

Let me explain. One of the great learning experiences one can have is taking an existing and functional program and adding features to it. Now while I agree with my college professor who told me over 30 years ago that no program is ever really finished it's nice to have some low hanging fruit. This program has room for all sorts of additional features. What sort of features?

  • Adding color coding of rows, columns or subgrids that are completed.

  • Additional error checking

  • A timer - how long does it take you to finish?

  • Top times recording - ideally at each level

  • Replace the command buttons with textboxes for easier input

  • Tablet PC input with ink!

  • Make a Pocket PC version. IF you do that let me know so I can get a copy from you.

  • Probably a lot more that I haven't even had time to think about.

You will be able to work on this program using Visual Basic .NET Express. It was written for Visual Basic 2003 but Express upgraded it nicely for me without any errors. A couple of warnings that we easily fixed because I hate warnings.

Send your students after this one. Try it out yourself. Is it the greatest implementation of Sudoku ever? No it's not. But what it is is an easy to understand, very manageable piece of code that lends itself to extension, expansion, improvement, experimentation and just plain fun. And are those all really good things for over the holidays?

Speaking of holidays - I'm taking next week off. It's time to spend Christmas with my family. Will I be blogging? Probably not very much if at all. I hope you are all getting some time off for the end of the year and enjoy what ever holiday you celebrate.


Comments (8)
  1. Alfred Thompson has a very good entry on Sudoku and Visual Basic .NET Express in education . Send your

  2. AlfredTwo says:

    I found an interesting little program that creates Sudoku puzzles in Visual Basic .NET. I have to say…

  3. Sorry but the example "Sudoku and Visual Basic .NET Express" version does not produce Sudoku puzzles, as they have more than one result. The first puzzle i tested against had 127 different end results. Sudoku has only one end. The code needs a little bit more work until it does what it says on the box.

    For an app that offers 35600 Sudoku 17 clue puzzles with solver and proof function go to and spend $1 US.

  4. AlfredTh says:

    You may be right. But I think the fact that there is VB source code that allows for a lot of room to try things and modify the program makes it useful for learning. The point is not really to solve the puzzle but to learn from the program.

  5. Tom Indelicato says:

    I have to agree with OneDollarSudoku: the definition of a "true" Sudoku puzzle is one where there is a single solution that can be solved without guessing. (THIS is what makes puzzle generators notoriously hard to write!) But, as you say, it is useful as a teaching tool.

  6. AlfredTh says:

    Well then we have another teachable moment here. The nice thing is that someone can write a better puzzle generating routine and throw it in to an existing structure for testing purposes. Weren’t you working on something along those lines Tom? 🙂

  7. Yuvi says:

    That’s not the best Sudoku Example you could choose. The code is pretty clumsy, with no distinction between the Sudoku Generation Code and the UI code. And it uses something which looks like Control Arrays of VB6… And, this is coming from a self-taught high school student who loves your blog:D

  8. AlfredTh says:

    I can’t disagree with you Yuvi. I would love to see someone clean that one up so I could use that as an "after" example in a before and after sample. Want to give it a try?

Comments are closed.

Skip to main content