"John Austin" <Jo*********@nospam.nospam> schrieb:
In the vb6 app a number of subs had optional date parameters:
Sub Fred ( ... ,optional FromDate as Date = 0...)
I need something like zero in there to see if the parameter has been used
or
not.
In vb.net the imported code fails with:
Value of type 'Integer' cannot be converted to 'Date'
I have to supply a default value for the date - is there anything I can
use
that obviously indicates that the parameter has not been supplied by the
caller?
I have recently written an article in German about supporting nullable date
and time values. Maybe you'll find some of the code snippets useful:
<URL:http://dotnet.mvps.org/dotnet/articles/nullabledates/>
In VB.NET 'Nothing' referes to a value type's default value. Thus you can
specify 'Nothing' as default value for the parameter. Note that this
doesn't work with VB 2002/2003, but will be supported in VB 2005. In
general I don't recommend to rely on a certain value to be interpreted as a
null value.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>