I have dgv with 4 colums (0,1,2,3) and variable number of rows.
I need to perform the calculation only if all cells in columns 1,2 and 3 are fullfilled. I tried with this code:
For r As Integer = 0 To mydgv.RowCount - 1 Step 1
For c As Integer = 1 To 3 Step 1
If mydgv.Item(c, r).Value Is Nothing Or mydgv.Item(c, r).Value Is "0" Then
MsgBox("Can not be zero or empty")
Exit Sub
Else
'do something
End If
Next c
Next r
but, calculation is performed even some cells are empty or zero. Obviously, something is wrong.
Any help will be appreciated.
I need to perform the calculation only if all cells in columns 1,2 and 3 are fullfilled. I tried with this code:
For r As Integer = 0 To mydgv.RowCount - 1 Step 1
For c As Integer = 1 To 3 Step 1
If mydgv.Item(c, r).Value Is Nothing Or mydgv.Item(c, r).Value Is "0" Then
MsgBox("Can not be zero or empty")
Exit Sub
Else
'do something
End If
Next c
Next r
but, calculation is performed even some cells are empty or zero. Obviously, something is wrong.
Any help will be appreciated.