Home > Blockchain >  C# Invalid expression term ' ='
C# Invalid expression term ' ='

Time:04-07

for (int i = 0; i <= dataGridView1.Rows.Count; i  )
{
    string point_value  = dataGridView1.Rows[i].Cells[1].Value   "|"; 
}

Does anyone know why I am getting this error

Invalid expression term ' ='

for this code?

CodePudding user response:

you create new variable with in your for loop that the reason

if you need to store data each loop you should create variable outside loop

like this

string point_value;
for(int i=0; i <= dataGridView1.Rows.Count; i  )
    {
        point_value  = dataGridView1.Rows[i].Cells[1].Value   "|"; 
    }

for more information about loop pattern here

  •  Tags:  
  • c#
  • Related