Null value

  • Thread starter Thread starter John
  • Start date Start date
John said:
Hi

What is a good general way to check for null values? I really miss Is Null.

Regards

Another poster cited IsNothing(), but there's also System.DBNull:

If rowTest("testcol") Is System.DBNull.Value Then
...
End If



Cheers!

RH
 
Hi Ross,
Another poster cited IsNothing(), but there's also System.DBNull:

If rowTest("testcol") Is System.DBNull.Value Then

It is confussing however this is not a textbox.text, this is an object while
the textbox.text is a String (as well an object however not of the same
type).

Therefore your answer is can only be regular when it is binded to the
dataset, and probably for a lot a little bit late moment to test the value,
however I think that there are a lot of scenario's where it can be a right
one. (Altough with this is in my opinion is better to use the binding
events).

I hope this helps?

Cor
 
Cor Ligthert said:
Hi Ross,


It is confussing however this is not a textbox.text, this is an object while
the textbox.text is a String (as well an object however not of the same
type).

Therefore your answer is can only be regular when it is binded to the
dataset, and probably for a lot a little bit late moment to test the value,
however I think that there are a lot of scenario's where it can be a right
one. (Altough with this is in my opinion is better to use the binding
events).

I hope this helps?

I would tend to agree. Of course, one could use this in scenarios where
populating controls in a form from a database, where Null values throw an
exception. While there are numerous other ways of handling this, I thought
it might be worth noting that "Null" isn't totally gone. ;)

RH
 
Back
Top