Noobs .. realy man ?
Ok ..
1. Name your stuff properly
2.
Example Code:
Code:
private void Button6_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button6.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button6.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button6.Enabled = false;
}
private void Button7_Click(object sender, EventArgs e)
{
if (Operators.CompareString(this.Label2.Text, "X", false) == 0)
{
this.Button7.Text = "X";
this.Label2.Text = "0";
}
else
{
this.Button7.Text = "0";
this.Label2.Text = "X";
}
this.win();
this.Button7.Enabled = false;
etc...
}
The same code over and over again is bad style and a pain for maintaining, your Task, think about a way to solve this
3.
Example Code:
Code:
if (Operators.CompareString(this.Button1.Text, "X", false) == 0 & Operators.CompareString(this.Button2.Text, "X", false) == 0 & Operators.CompareString(this.Button3.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
if (Operators.CompareString(this.Button4.Text, "X", false) == 0 & Operators.CompareString(this.Button5.Text, "X", false) == 0 & Operators.CompareString(this.Button6.Text, "X", false) == 0)
{
this.Label2.Text = "X wins";
this.Button1.Enabled = false;
this.Button2.Enabled = false;
this.Button3.Enabled = false;
this.Button4.Enabled = false;
this.Button5.Enabled = false;
this.Button6.Enabled = false;
this.Button7.Enabled = false;
this.Button8.Enabled = false;
this.Button9.Enabled = false;
}
etc ..
Same again, think about an algorithm which is able to calculate who is the winner.