Sample Code: Sudoku in VB .NET


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

Sudoku is a logic-based location puzzle game normally played using numbers.

This is simply an introduction to some of the facets of VB .NET using the mathematics behind Sudoku.

About the Author

Michael Champion

Degrees in Computer Science from the State University of New York at Buffalo (UB) and the Rochester Institute of Technology (RIT). Still serving time as a Software Engineer.



  • Sudoku Game

    Posted by Keara on 05/05/2015 02:08am

    Can you please guide me of sudoku game using vb.net? I can't created.

  • Great

    Posted by Bogdan on 04/29/2015 10:23am

    Thats a great program and algorythm , i have problems at understanding the GetValidVals , but i understand the rest of the code.Thank you for this program , it really helped me .

  • Sudoku solution

    Posted by sweety234 on 09/05/2007 12:42pm

    Can any one send SUDOKU solution program to me ....?

    • RE: Can any one send SUDOKU solution ...

      Posted by msc0686@yahoo.com on 09/05/2007 07:11pm

      Yes. Actually a better picture-version of this game application is available via www.AisleOfPlenty.com.

  • Great Example

    Posted by VPOwner on 12/29/2006 03:55am

    My wife loves this game, so I compiled it for her :). There is one aspect of the program which is not present however, it will show the correct solution, but I would like to make a new button which will compare the user's solution to the correct one, and then highlight each incorrect answer. Being new to VB I am not exactly sure how to do this, can you suggest some examples that I could look into to do this? I like doing things like this to help myself learn, I learn much more when I do things hands on and make them work. Thanks!

    • Thanks

      Posted by msc0686@yahoo.com on 12/29/2006 04:09pm

      Nothing like being a nerd to impress the chicks, hey (:-))?  Just kidding, I'm a nerd and my wife loves me for it for some odd reason.
      One way to accomplish a "differences" button would be to simply integrate it with the existing btnShowSolution button.  You can always try to add another button and fill-in it's code-behind, but the code change for the existing one is rather simple (add lines between "*********" comments)...
          Private Sub btnShowSolution_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowSolution.Click
              Dim i As Integer
              If SolutionShown Then
                  For i = 1 To 81
                      CurButtons(i).Text = SudokuTemp(i)
                      CurButtons(i).ForeColor = System.Drawing.Color.Black
                  Next i
                  btnShowSolution.Text = "Show Solution"
                  For i = 1 To 81
                      SudokuTemp(i) = CurButtons(i).Text
                      CurButtons(i).Text = SudokuSolution(i)
                      If CurButtons(i).Text <> SudokuTemp(i) Then
                          CurButtons(i).ForeColor = System.Drawing.Color.Red
                          CurButtons(i).ForeColor = System.Drawing.Color.Green
                      End If
                  Next i
                  btnShowSolution.Text = "Hide Solution"
              End If
              SolutionShown = Not SolutionShown
          End Sub
      Hope this helps.  Happy New Year!

      • what??

        Posted by paul on 08/02/2014 08:27am

        What is this "CurButtons"? i don't understand what was the meaning of that because i usually use only cmd for command buttons, lbl for label and so many more so that i can determined what particular name i used it....can you determine what "CurButtons" used for?

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date