Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8331695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:29:31+00:00 2026-06-09T02:29:31+00:00

i made a sudoku game using windows forms, the datagrid was very easy to

  • 0

i made a sudoku game using windows forms, the datagrid was very easy to handle, for example

dataGridView1[2,3]=5;

now in wpf the datagrid cant be used like this and i need to find the easiest way to test and fill the grid, for example i had codes like :

for (i = 0; i < 9; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    for (k = j + 1; k < 9; k++)
                    {
                        if (dataGridView1[i, k].Value != null)....

                        }
                    }
                }
            }

any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:29:33+00:00Added an answer on June 9, 2026 at 2:29 am

    I would not read the content of the dataGridView. Instead I would bind a control (such as the datagridview) to a data structure that represents the values in the Sudoku.

    This would allow you to simply check the data structure (even add methods, properties and events to it)

    Just make a Grid (9×9 cells) and a textblock in each cell and bind the text property of each cell to an element of a two dimensional array:

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            ...
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            ...
        </Grid.RowDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding Path=Cells[0][0]}"/>
        <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=Cells[1][0]}"/>
        <TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding Path=Cells[2][0]}"/>
        ...
    </Grid>
    

    And set the Grid’s DataContext in code:

    class Sudoku
    {
        public int[,] Cells = new int[9,9];
        ...
    }
    
    
    private Sudoku _sudoku;
    
    MainWindow_Loaded(...)
    {
        _sudoku = new Sudoku();
        grid.DataContext= _sudoku;
    
    }
    

    Now you can simply set and check _sudoku.Cells[2,3]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made this windows forms application in .net 3.5 (VS c# express) . Now
I made a form in php. I am using 3 different forms in the
Made a simple app which using a timer, counts the number of mouse clicks
I made of subclass of UIView called Bubble using which i want to draw
I made a form using the Qt Designer which has some dockwidgets, these dockwidgets
I'm working on a Windows Phone 7 Silverlight puzzle game that is sort of
I made a page using HTML which have some .jpg files and some .swf
I made a custom cell in a UITableView using IB and Storyboards. The code
I made a sweet system update feature for this game I'm making here is
I made a pie chart using the jqPlot and the pie chart did render,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.