sam wrote:
I have an error message during perform dateserial in VB.Net 1.1 based
on my coding as shown as below:
[...] Dim Inv_Date, GL_Date, InvDte,GLdte As Double
GL_Date = DateSerial(1900 +(GLdte/1000), 1,GLdte Mod 1000)
[...]
Ah, that's not a problem with DateSerial, that's a problem with variable
typing.
In VB6, dates were stored as Double values so you could directly assign a
Date to a Double variable.
In VB.NET, dates have their own distinct type (Date) and you can't directly
convert between them.
If you want to do what you're doing above, you will need to either:
1. Change your GL_Date (and probably your other variables too) to be defined
As Date instead of As Double. However, this will most likely break your
dbrRD_F0411B calls as they presumably return Double values too. You'll need
to change these to also return Date values.
2. Alternatively, leave your variables as Doubles and use the OLE Automation
Date conversion functions. These two methods are defined against the Date
class are can be used to convert a value from a Date to a Double (the
ToOADate() function) or from a Double to a Date (the FromOADate() function).
\\\
'Convert Date to a Double
GL_Date = DateSerial(2005 ,5,30).ToOADate
'Convert Double back to a Date
Dim d As Date = Date.FromOADate (GL_Date)
///
Hopefully that'll set you off in the right direction.
--
(O) e n o n e