I'm looping through all cells in a selected row, trying to check for emtpy (either null or just empty string), but i'm getting the following error:
System.NullReferenceException was unhandled
My code looks like:
The bolded line is where it fails. Previously, i had just the first part of the if statement, but in playing around, i tried to also add the "Not (IsNothing(cell.Value)) " to see if it would help.
Any help would be appreciated!
Thank you.
System.NullReferenceException was unhandled
My code looks like:
VB.NET:
For Each cell As DataGridViewCell In row.Cells
If ignoreRow = False Then
Exit For
End If
[B]If Not String.IsNullOrEmpty(cell.Value.ToString) Or Not (IsNothing(cell.Value)) Then[/B] Debug.Print(cell.Value.ToString)
ignoreRow = False
End If
Next
The bolded line is where it fails. Previously, i had just the first part of the if statement, but in playing around, i tried to also add the "Not (IsNothing(cell.Value)) " to see if it would help.
Any help would be appreciated!
Thank you.