Stripping Nulls in a "Typed" Manner

Category:
Miscellaneous
Type:
Snippets
Difficulty:
Beginning
Author:
Stephen Goguen

Version Compatibility:

More information:
A potential problem with converting Nulls to empty strings or whatever data type is that CStr() CLng() CCur() etc. raise errors...

Just do like below and have ToStr(), ToLng(), etc. available when you need to ignore these errors... It will make your code look much cleaner too...

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: