Dealing with null value cells in a datagridview

I have a datagridview with various columns - where one column has some data on a some rows - with most of the rows having no data ( null info).I want to read row by row skipping any row where the data is null.In VB6 I wrote if column = "" then -skip to next column. This does not work in VB8. Can anyone help please.
I have tried code like
"If Convert.ToInt32(Me.TransactDataGridView.Rows(i).Cells(1).Value.ToString()) = 0 Then"
-this does not work.
LensuluAsked:
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.

AshokSr. Software EngineerCommented:
Try

If (Me.TransactDataGridView.Rows(i).Cells(1).IsDbNull) Then

Ashok
0
AshokSr. Software EngineerCommented:
Should this be also in Visual Basic.NET ZONE ?

Ashok
0
LensuluAuthor Commented:
My telesense does not pick up isdbnull. Am i missing a space import.
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

LensuluAuthor Commented:
My telesense does not pick up isdbnull. Am i missing a space import.I only need in vb net.
0
AshokSr. Software EngineerCommented:
       Dim ob As Object = Me.TransactDataGridView.Rows(1).Cells(1)
        If (Convert.IsDBNull(ob)) Then

        End If

HTH
Ashok
0
AshokSr. Software EngineerCommented:
      Dim ob As Object = Me.TransactDataGridView.Rows(i).Cells(1)
       If (Convert.IsDBNull(ob)) Then

       End If

HTH
Ashok
0
AshokSr. Software EngineerCommented:
Could you add ZONE "Visual Basic.NET" to this question?

Ashok
0
AshokSr. Software EngineerCommented:
This might be helpful.

http://www.freevbcode.com/ShowCode.asp?ID=5810

Ashok
0
LensuluAuthor Commented:
 Dim ob As Object = Me.TransactDataGridView.Rows(i).Cells(1)
            rbPayandDEp.Checked = True
            'here code for both

            counter = 0
            Do While i < rowcount - 1
                ' If (Me.TransactDataGridView{ColumnIndex=1,Rowindex=i} = "x" Then
                ' MsgBox(Me.TransactDataGridView.Rows(i).Cells(1).ToString)
                If (Convert.IsDBNull(ob)) Or (Me.TransactDataGridView.Rows(i).Cells(1).Value.ToString) = " " Then
                    Me.TransactDataGridView.Rows(i).Cells(1).Value = prefix + ((startnumber + counter).ToString)
                    'increment counter when found
                    counter = counter + 1
                 
                End If
             
                i = i + 1



            Loop
The above code does not code the blanks or null items.It just runs through without an error.

You asked me to include ZONE vbNet - how do i do that at this point. It is a Zone VB net problem.

Thansk
0
j-horbCommented:
If IsDBNull(Me.TransactDataGridView.Rows(i).Cells(1)) Then


End If
0
AshokSr. Software EngineerCommented:
Dim ob As Object
            rbPayandDEp.Checked = True
            'here code for both

            counter = 0
            Do While i < rowcount - 1
                ' If (Me.TransactDataGridView{ColumnIndex=1,Rowindex=i} = "x" Then
                ' MsgBox(Me.TransactDataGridView.Rows(i).Cells(1).ToString)

                ob = Me.TransactDataGridView.Rows(i).Cells(1)

                If (Convert.IsDBNull(ob)) Or (Me.TransactDataGridView.Rows(i).Cells(1).Value.ToString) = " " Then
                    Me.TransactDataGridView.Rows(i).Cells(1).Value = prefix + ((startnumber + counter).ToString)
                    'increment counter when found
                    counter = counter + 1
                End If
                i = i + 1
            Loop

HTH
Ashok
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
LensuluAuthor Commented:
Thanks - I'm learning.first steps taken.

0
LensuluAuthor Commented:
Finally solved problem - thanks very much
Ashkok111.
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
Microsoft Applications

From novice to tech pro — start learning today.