"shapper" <md*****@gmail.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.com...
I defined a DateTime variable:
Dim dt As New DateTime
How can I check if it is empty?
Basically I want to check if it was given to it a DateTime value or
not.
You can't, at least, not 100% reliably. When a DateTime variable is
instantiated, its default value is DateTime.MinValue, not null. You could
check whether dt = DateTime.MinValue, but it will never be null (or empty)
because it is a value type.
..NET 2 introduced the concept of nullable datatypes e.g. DateTime? as well
as DateTime etc. However, when a DateTime? variable is instantiated, it also
has a default value of DateTime.MinValue - you can, though explicitly set a
DateTime? variable to null, which you can't do with a DateTime variable...