IIf Function parse both the true part and false part while evaluating the expression.. Am i missing anything? Try this statement and let me know!!
Example:
Dim sample = ""
Dim result = IIf(String.IsNullOrWhiteSpace(sample), 0, Integer.Parse(sample))
Exception = "Input string was not in a correct format."
Fix:
Dim result = Integer.Parse(IIf(String.IsNullOrWhiteSpace(sample), 0, sample))
http://msdn.microsoft.com/en-us/library/27ydhh0d(v=VS.71).aspx