String.IsNullOrWhiteSpace(valuefromDB) throws error if valuefromDB is dbnull.value
Is that correct??
I thought of this function will also handles the dbnull.value
If you had Option Strict On your code would never have compiled, because the IsNullOrWhiteSpace method on string accepts a string type, DBNull isn't a string type (it's DBNull), and at a guess your valuefromDB variable is of type Object.
The IsNull in the name IsNullOrWhiteSpace is actually referring to the CLRs null which in VB is Nothing, not DBNull
You can either check for both DBNull and IsNullOrWhiteSpace or as pointed out by Emaad Ali, use the VB function IsNothing.
Hope this helps