Creating a sudoku. Should I use while statement for this code? (Windows Form Application C#)

0 Peter Nguyen · September 18, 2015
I'm making a sudoku in  Windows Form Application.
I have 81 textboxes and I have named them all textBox1a, textBox1b... textBox2a, textBox2b...

I want to make it so that if any of the textboxes, in any of the rows, is equal to any other textbox in the same row, then both will get the background color red while the textboxes are equal.

I tried using this code just for test: 


private void textBox1a_TextChanged_1(object sender, EventArgs e)
        {
            while (textBox1a.Text == textBox1b.Text)
            {
                textBox1a.BackColor = System.Drawing.Color.Red;
                textBox1b.BackColor = System.Drawing.Color.Red;
            }


It didn't work, and I don't know where I should put all this code, I know I shouldn't have it in the textboxes.
Should I use a code similar to this or is it totally wrong?


I hope what I have requested isn't complete nonsense because I'm not very good at C# yet.
I really appreciate any help you can provide!

Post a Reply

Replies

Oldest  Newest  Rating
0 jude Avelino · October 19, 2015
same problem bro. Do you have sudoku already?, Please help me :) 
0 jude Avelino · October 19, 2015
@jethro daniel how to use group box in displaying 81 boxes?
0 jethro daniel · September 21, 2015
Why the hell would you name 81 boxes with thesame name. I'll advice using a group box or table then select all the child controls.
  • 1

C#

107,168 followers
About

C# is an object-oriented language designed for improving the development of web applications.

Links
Moderators