Hi, I have some value at column named "data".
I need to scan the value at that column, if more than "2", then column named "1" will be "1 = data -2"
Then at next row and still in current column named "data" , if more than "2", then column named "1" will be "1 = data ".
Because I just want the operation done in once.
The problem is, how to make the operation done in once ? the code below show it scan all the row
The picture below show the data I highlighted.
The picture below show the error.
Here the code :
Try
For x As Integer = 0 To DataGridView1.Rows.Count - 1
'Strategy 1
If Val(DataGridView1.Rows(x).Cells(7).Value) <= 2 Then
DataGridView1.Rows(x).Cells(7 + 1).Value = DataGridView1.Rows(x).Cells(7).Value - 2
Else
DataGridView1.Rows(x).Cells(7 + 1).Value = DataGridView1.Rows(x).Cells(7).Value
End If
Next
Catch ex As Exception
End Try