Click here to Skip to main content
16,013,082 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table like this: (using DGV)
VB
ID    Counter    Customer
1      NULL       3G001
2      NULL       3B002
3       1         3B003
4      NULL       3P004
5       2         3P005


and a code like this:

VB
Dim x As Integer = 0
        While x <> DGVcheckq.RowCount

            If DGVcheckq.Rows(x).Cells(1).Value = "1" Then
                LBLq1.Text = DGVcheckq.Rows(x).Cells(2).Value
            ElseIf DGVcheckq.Rows(x).Cells(1).Value = "2" Then
                LBLq2.Text = DGVcheckq.Rows(x).Cells(2).Value
            End If
            x = x + 1
        End While


i wanna scan the table for customers that has a '1' or '2' Counter
but others are null so my code won't work. Can you guys give me another alternative code to scan a table with nulls?

Thanks in advance
Posted

First check DGVcheckq.Rows(x).Cells(1).Value against DBNull.Value, you may find a code sample in the documentation[^].
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900