VB 2008 - Is a DataGridView field null or empty?

If a grid field does not contain data then Completed = False.  The fields to be tested may contain text, a numeric, a date, or nothing at all.  It is possible that some data was entered into one of the fields and then removed by the user.

How can I test that a Value exists?  The design-time compiler does not like the following statement.

If EvalItemsDataGridView.CurrentRow.Cells(i).Value() = Nothing Then Completed = False
ljcorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wellholeCommented:
You will want to use "is nothing" instead of "= nothing".
0
ljcorAuthor Commented:
Unfortunately, it does not like  IsNothing  either.
0
wellholeCommented:
2 words.......
0
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

ljcorAuthor Commented:
It doesn't like that either:  two words, two errors.

IS says: Expression expected

NOTHING says: Illegal call expression or index expression
0
wellholeCommented:
Please post your code after the modification.
0
ljcorAuthor Commented:
       Dim Completed As Boolean = True
        For i As Integer = 0 To 8
            If EvalItemsDataGridView.CurrentRow.Cells(i).Value() = Is Nothing() Then Completed = False
        Next
        If Completed = False Then
            Call MsgBox("You cannot SELECT a Project until these data entry items are completed.  ", vbOKOnly + vbCritical + vbApplicationModal + vbDefaultButton1, "UNFINISHED DATA ENTRY")
            Exit Sub
        End If
0
wellholeCommented:
REMOVE = and Nothing() is not a function so remove ()
0
jbeasle3Commented:
Try this:
 
If EvalItemsDataGridView.CurrentRow.Cells(i).Value() = String.Empty Then Completed = False
OR
If EvalItemsDataGridView.CurrentRow.Cells(i).Value() = "" Then Completed = False
0
ljcorAuthor Commented:
I edited the data out of one of the fields:  The runtime error is:
   "Operator '=' is not defined for type 'DBNull' and string ""."
0
wellholeCommented:
Use isdbnull(EvalItemsDataGridView.CurrentRow.Cells(i).Value()) instead of comparing against an empty string.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ljcorAuthor Commented:
YES!!  That worked perfectly.  Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.