Solved

Problems with Const in VBScript Class?

Posted on 2003-11-24
3
1,679 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
Classic ASP application Will support SQL 2014 5 102
SQL to update characters in table column 6 160
Bypass cross origin issues on development site 3 95
Designing forms 3 44
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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