Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Names of properties in custom classes

Posted on 2002-06-26
8
150 Views
Last Modified: 2013-11-23
I'd like to define a property named Date in a class that I am writing.

But, when I input the following property definition
   
    Public Property Get Date() As Date
        ...
    End Property

I get:

    Compile Error
    Expected: identifier

I'm assuming that this has something to do with the built in Date object.  Is there any way to get around this?
0
Comment
Question by:derekl
8 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 50 total points
ID: 7111189
Yes it is due to the intrinsic Date function.  You need to change the property name.  If it is a specific date, give it more meaning, e.g. LoginDate, DateSubmitted, InvoiceDate, etc.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7111297
You can try to suffix it with an underscore.  Not exactly what you want, but reasonably close.


Public Property Get Date_() As Variant

End Property

Public Property Let Date_(ByVal vNewValue As Variant)

End Property
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7111318
Keywords cannot be used as name for variables, constants, properties like any other language (as long as i know).
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7111644
Try this:

Public Property Get [Date]() As Date
0
 

Author Comment

by:derekl
ID: 7112547
Public Property Get[Date]() As Date did not work.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7113583
what about Azra and rspahitz comments?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7114017
Personally, I think Azra's comment makes the most sense (in addition to answering the Q!) since the date will most likely not be "generic" but will be related to something.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7180859
Why "B" grade? what were you waiting for?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question