Typing to Nullable (Of Date) vs typing to Date
This is just an example of the crux of the problem:
Returns date object as expected.
CType(CObj("11/09/2009"), Nullable(of Date))
In QuickWatch returns the string.
At runtime crashes out with invalid Cast.
Can someone explain the different behaviour to me please? I don't see
why one works and one doesn't.
Also assuming I have a gridview returning IOrderedDictionary, how do I
convert blanks strings to nothing and non-blank string to date? Do I
have to resort to IIF? Given that Nullable(of Date) can't cope with
different base types cast as objects I guess I'll have to...
In the case above I had a function returning a string, but when
'Nothing' was returned it got converted to an empty string. Then I
tried returning the string date or nothing in an object, but that
still didn't work.
I'm probably being a bit stupid. Apoplogies if the answer is simple...
|All times are GMT. The time now is 03:39 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.