HowTo check if Date is empty (#12.00.00 AM#) ???

  • Thread starter Thread starter Andreas Klemt
  • Start date Start date
A

Andreas Klemt

Hello,
I have this

Dim myDate As Date

...
...
How can I check if this date is empty (value #12.00.00 AM# is in there) ?

Thanks,
Andreas
 
Andreas Klemt said:
I have this
Dim myDate As Date
How can I check if this date is empty (value #12.00.00 AM# is in there) ?

Andreas,
Try using the Date.MinValue property

If myDate = Date.MinValue Then
' myDate is empty
End If

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
Thanks Carl,
that helped me!

What is better?
a) If myDate = Date.MinValue Then
b) If myDate.equals(Date.MinValue) Then

Regards,
Andreas
 
Andreas Klemt said:
What is better?
a) If myDate = Date.MinValue Then
b) If myDate.equals(Date.MinValue) Then

Better? They do the same task.

I prefer the "=" since (IMHO) it's more readable. Plus it's less typing... ;-)

I think it comes down to developer preference...

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
Back
Top