Skip to main content
error formatting
Source Link
Gilad Green
  • 37.1k
  • 7
  • 65
  • 97

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value"1value1 saying "the name does not exists in current context

the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
{
    Random b = new Random();
    float value = b.Next(50, 100);
}
private void button2_Click(object sender, EventArgs e)
{
    if (value < MinValue)
    {
       textBox18.Text = ("warning");
       textBox18.ForeColor = Color.White;
       textBox18.BackColor = Color.Red;
    }
 }

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value" saying "the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
{
    Random b = new Random();
    float value = b.Next(50, 100);
}
private void button2_Click(object sender, EventArgs e)
{
    if (value < MinValue)
    {
       textBox18.Text = ("warning");
       textBox18.ForeColor = Color.White;
       textBox18.BackColor = Color.Red;
    }
 }

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under 1value1 saying

the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
{
    Random b = new Random();
    float value = b.Next(50, 100);
}
private void button2_Click(object sender, EventArgs e)
{
    if (value < MinValue)
    {
       textBox18.Text = ("warning");
       textBox18.ForeColor = Color.White;
       textBox18.BackColor = Color.Red;
    }
 }
deleted 66 characters in body
Source Link
Jaydip Jadhav
  • 12.3k
  • 6
  • 25
  • 40

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value" saying "the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
    {
        Random b = new Random();
         float value = b.Next(50, 100);
 
        }
        
        
        private void button2_Click(object sender, EventArgs e)
    {
        if (value < MinValue)
        {
            textBox18.Text = ("warning");
            textBox18.ForeColor = Color.White;
            textBox18.BackColor = Color.Red;
        }
    }

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value" saying "the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
    {
        Random b = new Random();
         float value = b.Next(50, 100);
 
        }
        
        
        private void button2_Click(object sender, EventArgs e)
    {
        if (value < MinValue)
        {
            textBox18.Text = ("warning");
            textBox18.ForeColor = Color.White;
            textBox18.BackColor = Color.Red;
        }
    }

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value" saying "the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
{
    Random b = new Random();
    float value = b.Next(50, 100);
}
private void button2_Click(object sender, EventArgs e)
{
    if (value < MinValue)
    {
       textBox18.Text = ("warning");
       textBox18.ForeColor = Color.White;
       textBox18.BackColor = Color.Red;
    }
 }
Source Link

the name does not exist in current context (windows form)

I am new to c# and I know the answer is very simple I just could not find it through searching

I created two buttons the first one generates random values and the second one is an IF statement inside another button, but I`m getting a red line under "value" saying "the name does not exists in current context

private void button3_Click(object sender, EventArgs e)
    {
        Random b = new Random();
         float value = b.Next(50, 100);

        }
        
        
        private void button2_Click(object sender, EventArgs e)
    {
        if (value < MinValue)
        {
            textBox18.Text = ("warning");
            textBox18.ForeColor = Color.White;
            textBox18.BackColor = Color.Red;
        }
    }