【发布时间】:2015-07-28 04:56:25
【问题描述】:
如果满足这个条件,如何打破这个语句?
Val(DataGridView1.Rows(x).Cells(7).Value) <= 2
那么在上面的语句满足之后,应该继续这个语句
DataGridView1.Rows(x).Cells(7 + 1).Value = DataGridView1.Rows(x).Cells(7).Value
这是我的完整代码:
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
【问题讨论】:
-
BREAK 是什么意思?你的意思是你想退出循环?你的意思是你想停止执行?如果在 Col 7 中不止一行的值小于 2,会发生什么情况?请澄清中断的含义...使用上面的代码,它将按照您的意愿进行,然后继续下一行,直到处理完所有行...
标签: vb.net visual-studio-2010 datagridview vb.net-2010