When the max bet button is pushed,it is supposed to turn any buttons colored orange to their original color transparent first.
The Problem: It does change the buttons back to their original color but it does it at the same time it is changing other random numbers orange. I need it to first change them all to Transparent before it starts to pick the new numbers by changing them orange. (I hope I got the problem across well)
Here is a little snip-it of my code (WARNING: Newbie code, try not to hate on it too much
public Form1()
{
InitializeComponent();
}
int returnValue;
Random randObj = new Random(35);
Random random = new Random(35);
int tracker = 0;
int tokenTracker = 200;
private void button81_Click(object sender, EventArgs e)
{
button1.BackColor = Color.Transparent;
button2.BackColor = Color.Transparent;
button3.BackColor = Color.Transparent;
button4.BackColor = Color.Transparent;
button5.BackColor = Color.Transparent;
button6.BackColor = Color.Transparent;
button7.BackColor = Color.Transparent;
button8.BackColor = Color.Transparent;
button9.BackColor = Color.Transparent;
button10.BackColor = Color.Transparent;
button11.BackColor = Color.Transparent;
button12.BackColor = Color.Transparent;
button13.BackColor = Color.Transparent;
button14.BackColor = Color.Transparent;
button15.BackColor = Color.Transparent;
button16.BackColor = Color.Transparent;
button17.BackColor = Color.Transparent;
button18.BackColor = Color.Transparent;
button19.BackColor = Color.Transparent;
button20.BackColor = Color.Transparent;
button21.BackColor = Color.Transparent;
button22.BackColor = Color.Transparent;
button23.BackColor = Color.Transparent;
button24.BackColor = Color.Transparent;
button25.BackColor = Color.Transparent;
button26.BackColor = Color.Transparent;
button27.BackColor = Color.Transparent;
button28.BackColor = Color.Transparent;
button29.BackColor = Color.Transparent;
button30.BackColor = Color.Transparent;
button31.BackColor = Color.Transparent;
button32.BackColor = Color.Transparent;
button33.BackColor = Color.Transparent;
button34.BackColor = Color.Transparent;
button35.BackColor = Color.Transparent;
button36.BackColor = Color.Transparent;
button37.BackColor = Color.Transparent;
button38.BackColor = Color.Transparent;
button39.BackColor = Color.Transparent;
button40.BackColor = Color.Transparent;
button41.BackColor = Color.Transparent;
button42.BackColor = Color.Transparent;
button43.BackColor = Color.Transparent;
button44.BackColor = Color.Transparent;
button45.BackColor = Color.Transparent;
button46.BackColor = Color.Transparent;
button47.BackColor = Color.Transparent;
button48.BackColor = Color.Transparent;
button49.BackColor = Color.Transparent;
button50.BackColor = Color.Transparent;
button51.BackColor = Color.Transparent;
button52.BackColor = Color.Transparent;
button53.BackColor = Color.Transparent;
button54.BackColor = Color.Transparent;
button55.BackColor = Color.Transparent;
button56.BackColor = Color.Transparent;
button57.BackColor = Color.Transparent;
button58.BackColor = Color.Transparent;
button59.BackColor = Color.Transparent;
button60.BackColor = Color.Transparent;
button61.BackColor = Color.Transparent;
button62.BackColor = Color.Transparent;
button63.BackColor = Color.Transparent;
button64.BackColor = Color.Transparent;
button65.BackColor = Color.Transparent;
button66.BackColor = Color.Transparent;
button67.BackColor = Color.Transparent;
button68.BackColor = Color.Transparent;
button69.BackColor = Color.Transparent;
button70.BackColor = Color.Transparent;
button71.BackColor = Color.Transparent;
button72.BackColor = Color.Transparent;
button73.BackColor = Color.Transparent;
button74.BackColor = Color.Transparent;
button75.BackColor = Color.Transparent;
button76.BackColor = Color.Transparent;
button77.BackColor = Color.Transparent;
button78.BackColor = Color.Transparent;
button79.BackColor = Color.Transparent;
button80.BackColor = Color.Transparent;
Random randObj = new Random(35);
Console.WriteLine(randObj.Next().ToString());
Byte[] randArray = new Byte[25];
randObj.NextBytes(randArray);
--tokenTracker;
tokenTextBox.Text = "" + tokenTracker;
textBox1.Clear();
timer1.Start();
int returnValue = random.Next(1, 80);
for (int i = 0; i < randArray.Length; i++)
{
returnValue = random.Next(1, 80);
if (returnValue < 0)
{
returnValue = returnValue * -1;
}
if (returnValue == 1)
{
button1.BackColor = Color.Orange;
++tracker;
}
if (returnValue == 2)
{
button2.BackColor = Color.Orange;
++tracker;
}

New Topic/Question
Reply



MultiQuote








|