Question : What is wrong with this code?

This is a beginner's exercise that I'm working through.  I'm just attempting to change the background color of a form using the changing values from a for loop.    

The statement where I'm attempting to do this  (this.backcolor = color......) will not  except xVal as an argument.   I know this is basic, but you've got to start somewhere.

Thanks,

KF
1:
2:
3:
4:
5:
6:
7:
8:
private void button1_Click(object sender, EventArgs e)
    {
       for (int xVal = 0 ; xVal < 255; xVal = xVal + 1);
       {
         this.BackColor = Color.FromArgb(xVal, 255-xVal, xVal);
       }
            
    }

Answer : What is wrong with this code?

Remove the ";" from the end of the "for (int xVal = 0 ; xVal < 255; xVal = xVal + 1);" line.

50cal.
Random Solutions  
 
programming4us programming4us