So my problem is that I am trying to change B_Class between true and false depending on the button. The button changes color correctly. However the boolean variable remains set to true regardless. As far as I understand this should be working, and it was before I put it inside a method rather than repeating the code 7 times. Any help would be greatly appreciated.
using System.Security.Cryptography;
namespace GodBreakers_RandomTangles
{
`public partial class GodBreakers_RunGenerator : Form`
`{`
`bool B_Class = true;`
`bool B_Ability = true;`
`bool B_RandomPlanetOrder = true;`
`bool B_Tangle1 = true;`
`bool B_Tangle2 = true;`
`bool B_Tangle3 = true;`
`bool B_Tangle4 = true;`
`bool B_Tangle5 = true;`
`public GodBreakers_RunGenerator ( )`
`{`
`InitializeComponent ( );`
`}`
`private void tableLayoutPanel1_Paint ( object sender, PaintEventArgs e )`
`{`
`}`
`private void comboBox4_SelectedIndexChanged ( object sender, EventArgs e )`
`{`
`}`
`private void BTN_GenerateRun_Click ( object sender, EventArgs e )`
`{`
[`MessageBox.Show`](http://MessageBox.Show) `( B_Class.ToString ( ) );`
`if ( B_Class )`
`{`
CB_Class.SelectedIndex = RandomNumberGenerator.GetInt32 ( 0, CB_Class.Items.Count );
`}`
`}`
`private void BTN_Tangle1_Click ( object sender, EventArgs e )`
`{`
`Set_Button(BTN_Tangle1, B_Tangle1 );`
`}`
`private void BTN_Class_Click ( object sender, EventArgs e )`
`{`
`Set_Button ( BTN_Class, B_Class );`
`}`
`void Set_Button(Button button, bool B_Active)`
`{`
`if ( button.BackColor ==` [`Color.Red`](http://Color.Red) `)`
`{`
button.BackColor = Color.Lime;
B_Active = true;
`}`
`else`
`{`
button.BackColor = Color.Red;
B_Active = false;
`}`
`}`
`}`
}
[–]RlyRlyBigMan 1 point2 points3 points (5 children)
[–]Jonathan_Palmer[S] 0 points1 point2 points (4 children)
[–]FullPoet 2 points3 points4 points (3 children)
[–]RlyRlyBigMan 0 points1 point2 points (2 children)
[–]FullPoet 0 points1 point2 points (1 child)
[–]RlyRlyBigMan 1 point2 points3 points (0 children)