Mike L <Ca***@nospam.nospam> wrote:
This is for a Win form.
How do I check if the date variable is null?
DateTime dtDOB = (DateTime) dgSportsman[rowNum, 8];
It can't be. There's no concept of a null DateTime in C# 1.1. (There is
in 2.0 - or rather, there's the concept of a null Nullable<DateTime>.
However, if you want to find out whether a value from a database is
null, that's a different matter - you should be using DbNull. For
instance:
if (dgSportsman[rowNum, 8] is DbNull)
{
...
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too