Solved

Problems with Const in VBScript Class?

Posted on 2003-11-24
3
1,685 Views
Last Modified: 2010-05-19
Ok, I'm trying to be a "good" programmer by following the rules my professors drilled into my head years ago.  I'm currently writing some administration scripts in VBScript and have encapsulated a lot of my code into various classes.  Now I'm running to a problem when I declare a Const in the class, it gives me: "Syntax Error (800A03EA) Compilation Error" right at the point of declaring the Const.  It doesn't matter if I create it as a Private or Public Const.

I'm betting if I change them to variables they'll work, but I'd rather stay away from that since I've been doing a good job of keeping the code clean so far.  Is there a problem in VBScript that prevents declaring a Const in a class?  If so, is there a work-around outside of using variables?
0
Comment
Question by:CiQuat
[X]
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
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
d0zerz earned 50 total points
ID: 9813225
This page seems to suggest that in VBScript 5.0 there's a bug that prevents constants from being delcared in classes:

http://www.webmasterworld.com/forum47/680.htm

if you're concerned with good code (that's a good thing), assuming this guy is right in asserting that the const/class thing is a bug... just declare the variable as private to only access it through class methods..  That way you can ensure that the variable will never be touched (assuming you're the only one working on the class and you're not sloppy in accidentally assigning it)
0
 

Author Comment

by:CiQuat
ID: 9817913
Thank you d0zerz.  I'm also interested if anyone has found a workaround for Const (besides using class-private variables, as I was forced to do).
0
 

Author Comment

by:CiQuat
ID: 9849785
Well, I guess no one has anything to add.  Awarding points.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

707 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