Date, Date?, and the ToString Method in VB.Net
Read OriginalThis article details a common pitfall in VB.Net where developers confuse Date and Date? (Nullable(Of Date)) objects. The author describes encountering an 'Input string was not in a correct format' exception when trying to use a format string with ToString on a Date? object, which lacks the overload that accepts a format string. The solution involves converting the nullable date to a regular Date type using CType before calling ToString with the desired format. The article emphasizes understanding the underlying type differences rather than just copying code.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
No top articles yet