using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { public static Form1 fr1; public Form1() { InitializeComponent(); fr1 = this; } private void Form1_Load(object sender, EventArgs e) { textBox1.Hide(); textBox2.Hide(); textBox3.Hide(); } private void Row5_Slot3_TextChanged(object sender, EventArgs e) { NothingIsCorrect nIc = new NothingIsCorrect(); nIc.NothingIsCheck(); WrongWellPlace wp = new WrongWellPlace(); wp.WWP(); } } public class WrongWellPlace { public void WWP() { //Column 3 string[] WrongandWell3 = { Form1.fr1.TwoNum3.Text, Form1.fr1.NoCorrect3.Text, Form1.fr1.Row3_Slot3.Text, Form1.fr1.Row4_Slot3.Text, Form1.fr1.Row5_Slot3.Text }; for (int i = 0; i < WrongandWell3.Length; i++) { for (int j = i + 1; j < WrongandWell3.Length; j++) { if (WrongandWell3[i] == WrongandWell3[j]) { Form1.fr1.textBox3.Text = WrongandWell3[j]; } if (Form1.fr1.TwoNum3.Text == Form1.fr1.textBox3.Text) Form1.fr1.TwoNum3.BackColor = Color.DarkSeaGreen; if (Form1.fr1.NoCorrect3.Text == Form1.fr1.textBox3.Text) Form1.fr1.NoCorrect3.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row3_Slot3.Text == Form1.fr1.textBox3.Text) Form1.fr1.Row3_Slot3.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row4_Slot3.Text == Form1.fr1.textBox3.Text) Form1.fr1.Row4_Slot3.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row5_Slot3.Text == Form1.fr1.textBox3.Text) Form1.fr1.Row5_Slot3.BackColor = Color.DarkSeaGreen; } } //Column 2 string[] WrongandWell2 = { Form1.fr1.TwoNum2.Text, Form1.fr1.NoCorrect2.Text, Form1.fr1.Row3_Slot2.Text, Form1.fr1.Row4_Slot2.Text, Form1.fr1.Row5_Slot2.Text }; for (int i = 0; i < WrongandWell2.Length; i++) { for (int j = i + 1; j < WrongandWell2.Length; j++) { if (WrongandWell2[i] == WrongandWell2[j]) { Form1.fr1.textBox2.Text = WrongandWell2[j]; } if (Form1.fr1.TwoNum2.Text == Form1.fr1.textBox2.Text) Form1.fr1.TwoNum2.BackColor = Color.DarkSeaGreen; if (Form1.fr1.NoCorrect2.Text == Form1.fr1.textBox2.Text) Form1.fr1.NoCorrect2.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row3_Slot2.Text == Form1.fr1.textBox2.Text) Form1.fr1.Row3_Slot2.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row4_Slot2.Text == Form1.fr1.textBox2.Text) Form1.fr1.Row4_Slot2.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row5_Slot2.Text == Form1.fr1.textBox2.Text) Form1.fr1.Row5_Slot2.BackColor = Color.DarkSeaGreen; } } //Column 1 string[] WrongandWell1 = { Form1.fr1.TwoNum1.Text, Form1.fr1.NoCorrect1.Text, Form1.fr1.Row3_Slot1.Text, Form1.fr1.Row4_Slot1.Text, Form1.fr1.Row5_Slot1.Text }; for (int i = 0; i < WrongandWell1.Length; i++) { for (int j = i + 1; j < WrongandWell1.Length; j++) { if (WrongandWell1[i] == WrongandWell1[j]) Form1.fr1.textBox1.Text = WrongandWell1[j]; if (Form1.fr1.TwoNum1.Text == Form1.fr1.textBox1.Text) Form1.fr1.TwoNum1.BackColor = Color.DarkSeaGreen; if (Form1.fr1.NoCorrect1.Text == Form1.fr1.textBox1.Text) Form1.fr1.NoCorrect1.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row3_Slot1.Text == Form1.fr1.textBox1.Text) Form1.fr1.Row3_Slot1.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row4_Slot1.Text == Form1.fr1.textBox1.Text) Form1.fr1.Row4_Slot1.BackColor = Color.DarkSeaGreen; if (Form1.fr1.Row5_Slot1.Text == Form1.fr1.textBox1.Text) Form1.fr1.Row5_Slot1.BackColor = Color.DarkSeaGreen; } } } } public class NothingIsCorrect { public void NothingIsCheck() { string[] NoOne = { Form1.fr1.NoCorrect1.Text, Form1.fr1.NoCorrect2.Text, Form1.fr1.NoCorrect3.Text }; //Row 1 if (NoOne.Contains(Form1.fr1.TwoNum1.Text)) Form1.fr1.TwoNum1.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.TwoNum2.Text)) Form1.fr1.TwoNum2.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.TwoNum3.Text)) Form1.fr1.TwoNum3.BackColor = Color.RosyBrown; //Row 3 if (NoOne.Contains(Form1.fr1.Row3_Slot1.Text)) Form1.fr1.Row3_Slot1.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row3_Slot2.Text)) Form1.fr1.Row3_Slot2.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row3_Slot3.Text)) Form1.fr1.Row3_Slot3.BackColor = Color.RosyBrown; //Row 4 if (NoOne.Contains(Form1.fr1.Row4_Slot1.Text)) Form1.fr1.Row4_Slot1.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row4_Slot2.Text)) Form1.fr1.Row4_Slot2.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row4_Slot3.Text)) Form1.fr1.Row4_Slot3.BackColor = Color.RosyBrown; //Row 5 if (NoOne.Contains(Form1.fr1.Row5_Slot1.Text)) Form1.fr1.Row5_Slot1.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row5_Slot2.Text)) Form1.fr1.Row5_Slot2.BackColor = Color.RosyBrown; if (NoOne.Contains(Form1.fr1.Row5_Slot3.Text)) Form1.fr1.Row5_Slot3.BackColor = Color.RosyBrown; } } }