Function to check empty cells found or not in Datagrid
The ByRef simply means that what you feed in here is going to be affected by what you do to it in the function.  You are passing a Variable or object into the function, whereas ByVal you are only passing the value of the Variable into the function/method.

Also, I am not sure what exactly you were meaning to do with this:


Dim d = Trim(cell.Value.ToString())



but it is an orphan, it is not being used for anything.

Another thing that you should keep in mind is that VB is sensitive and you should indent consistently with the VB Standard.

so the entire function should be indented like this:

Public Function IsDataGridViewEmpty(ByRef dataGridView As DataGridView) As Boolean
    Dim isEmpty As Boolean
    isEmpty = False
    For Each row As DataGridViewRow In dataGridView.Rows             
        For Each cell As DataGridViewCell In row.Cells                
            If Not String.IsNullOrEmpty(cell.Value) Then              

                If Not String.IsNullOrEmpty(Trim(cell.Value.ToString())) = True Then
                    Dim d = Trim(cell.Value.ToString())
                    isEmpty = False

                End If
            Else
                isEmpty = True
                Exit For
            End If
        Next
    Next
    Return isEmpty
End Function