Re: Newbie: How to extract year from a Date object

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I just found out that if you use "Year" as an item in Enum, it will not
work. It would give you a compile time error.

Example:

Private Enum enumDates
Year
Month
Day
End Enum

This will override Year(), Month(), and Day() functions since they are part
of VBA library, which is part of VB6.

To avoid these problems, I always prefix Enum elements with "enm" or "enum".
Most likely I would write it like this:

Private Enum enumDates
enmDateYear
enmDateMonth
enmDateDay
End Enum



"Someone" <nobody@xxxxxxx> wrote in message
news:pnXXe.44109$ct5.2692@xxxxxxxxxxxxx
>I found that VB6 does not prevent you from using Year as a variable, and
>hence, some developers think it doesn't work.
>
>
> "Jeff Johnson [MVP: VB]" <i.get@xxxxxxxxxxx> wrote in message
> news:%23lSce1fvFHA.3764@xxxxxxxxxxxxxxxxxxxxxxx
>>
>> "Newbie" <steve@xxxxxxxx> wrote in message
>> news:GpVXe.812$hW.755@xxxxxxxxxx
>>
>>> I have (had) the following problem which i worked around but i would
>>> still like to find an answer.
>>>
>>> if myDate is e.g. : #02/04/1998# how do i extract the year ?
>>>
>>> Year(myDate) is only for VBA.
>>
>> Since when?
>>
>
>


.



Relevant Pages

  • Re: Newbie: How to extract year from a Date object
    ... if you use the full syntax for the vba functions ... Private Enum enumDates ... > Private Enum enumDates ... > enmDateYear ...
    (microsoft.public.vb.general.discussion)
  • Re: How do I Convert the following c typedefs
    ... int timeout; ... There is no 'long long' 64 bit data type in VB6. ... Dim CIP_LINT1 As Long ... Public | Private Enum EPath_Format ...
    (microsoft.public.vb.general.discussion)
  • Re: How do I Convert the following c typedefs
    ... There is no 'long long' 64 bit data type in VB6. ... Dim CIP_LINT1 As Long ... Public | Private Enum EPath_Format ...
    (microsoft.public.vb.general.discussion)
  • Re: MSgBox in VB.Net 2005
    ... don't try to code exactly as in VB6. ... things are done differently plus you have a ... What have you tired that doesn't work (in VB.NET enums are using the enum ... Rage Against The Machine - Sleep Now In The Fire ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Accessing enumerators in C# DLL from VB6
    ... I have to access enumerators of the enum that is ... Currently I can do that from VB6 only by ... that is) which was with a dot, ... Currently I have the enum placed outside of any classes. ...
    (microsoft.public.vb.general.discussion)