Evaluating a null in VB

  • Thread starter Thread starter Schoo
  • Start date Start date
S

Schoo

In earlier versions of VB I used to use the "IsNull(<variable>)" code to
check for null values in a dataset. This no longer works in .NET. What is
the proper way to validate a varialbe in .NET to see if it is a null?

Scott
 
Schoo said:
In earlier versions of VB I used to use the "IsNull(<variable>)" code to
check for null values in a dataset. This no longer works in .NET. What is
the proper way to validate a varialbe in .NET to see if it is a null?

I'm not a VB person, but I believe it's:

If variable = Nothing
 
That doesn't work in this case because I am comparing an item from a
dataset:'s datarow collection:

if dr.item(3) = Nothing Then...

In the past I would have done this:

if isNull(dr.item(3)) then...

I hope someone here has the answer.

Scott
 
That did the trick! Thanks Les... I figured it was something simple. I
also checked out your article and added it to my Favorites list.

Thanks!
 
Back
Top