Question form sudoku board solver

brokenamboy

New member
Joined
Oct 6, 2021
Messages
2
Programming Experience
Beginner
Hi All,
I am relatively new to C# and coding as a whole and currently attempting to create a program for my project of a "sudoku solver." The problem I am running into is the user inputting their numbers into a grid of a 9x9 text boxes and going about coding solving the entire grid. I have tried a 2D array and its not quite displayed as I would like it and doesn't provide a simple UI for somebody to input the values. The program also uses backtracking; does anybody have an idea of where to start and if so it would be a great help if you could point me in the right direction!
 
The UI and the data storage are two separate topics so you should ask about one or the other in a particular thread, unless it's specifically about the mapping of data from to the other, which would belong in a different thread again.

With regards to the UI, I would recommend using a TableLayoutPanel with nine rows and nine columns and your TextBox controls in the cells. With regards to the data storage, a 2D array is absolutely what you should use. They often get abused but this is one scenario where they are completely appropriate. You can map from the TextBoxes to the array elements using the row and column indexes of the TableLayoutPanel.

Take this advice on board and do what you can for yourself. If you encounter a specific issue then provide a FULL and CLEAR explanation of that issue, including exactly what you're trying to achieve, how you're trying to achieve it, what happens when you try and how and where that differs from your expectations.
 
Break down the big problem into smaller problems. Solve each problem in turn.

The array is your data model. You can write any kind of UI you want to display your data model. You can use a bunch of textboxes, labels, a data grid view, or just directly paint on the form as mentioned above.
 
The UI and the data storage are two separate topics so you should ask about one or the other in a particular thread, unless it's specifically about the mapping of data from to the other, which would belong in a different thread again.

With regards to the UI, I would recommend using a TableLayoutPanel with nine rows and nine columns and your TextBox controls in the cells. With regards to the data storage, a 2D array is absolutely what you should use. They often get abused but this is one scenario where they are completely appropriate. You can map from the TextBoxes to the array elements using the row and column indexes of the TableLayoutPanel.

Take this advice on board and do what you can for yourself. If you encounter a specific issue then provide a FULL and CLEAR explanation of that issue, including exactly what you're trying to achieve, how you're trying to achieve it, what happens when you try and how and where that differs from your expectations.
Thank you ever so much and I will try my best! I'm very sorry for the tentative instructions on what I was trying to make but again I'm thankful of you trying to make sense of it. And I'm sure you'll hear from me again.
 
Back
Top Bottom