Home All Groups Group Topic Archive Search About
Author
14 Apr 2005 4:09 PM
Elena
Can anyone see a problem with the code below.  The DateDiff section is
getting an error:  Overload resolution failedbecause no accessible "DateDiff"
can be called without a narrowing conversion.

        If strEndDate <> strBegDate Then
            Dim strDiff As Long = DateDiff(DateInterval.Day, strBegDate,
strEndDate)
        End If

Thanks in Advance :)

Author
14 Apr 2005 4:31 PM
Chris
Elena wrote:
> Can anyone see a problem with the code below.  The DateDiff section is
> getting an error:  Overload resolution failedbecause no accessible "DateDiff"
> can be called without a narrowing conversion.
>
>         If strEndDate <> strBegDate Then
>             Dim strDiff As Long = DateDiff(DateInterval.Day, strBegDate,
> strEndDate)
>         End If
>
> Thanks in Advance :)


Try converting your String to Date types.  That should clear up your issues.

Chris
Author
14 Apr 2005 5:34 PM
Herfried K. Wagner [MVP]
"Elena" <El***@discussions.microsoft.com> schrieb:
> Can anyone see a problem with the code below.  The DateDiff section is
> getting an error:  Overload resolution failedbecause no accessible
> "DateDiff"
> can be called without a narrowing conversion.
>
>        If strEndDate <> strBegDate Then
>            Dim strDiff As Long = DateDiff(DateInterval.Day, strBegDate,
> strEndDate)
>        End If

Either use 'DateDiff(DateInterval.Day, CDate(strBegDate), CDate(strEndDate)'
or specify '"d"' instead of 'DateInterval.Day'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>