value
is defined in the scope of the button3_Click
and thus not accessible for the button2_Click
. Put it as a variable of the class:
private int _minValue = 50;
private int _maxValue = 100;
private float value_value = 0;_maxValue;
private void button3_Click(object sender, EventArgs e)
{
Random b = new Random();
float value_value = b.Next(50_minValue, 100_maxValue);
}
private void button2_Click(object sender, EventArgs e)
{
if (value_value < MinValue_minValue)
{
textBox18.Text = ("warning");
textBox18.ForeColor = Color.White;
textBox18.BackColor = Color.Red;
}
}