Forum Moderators: open

Message Too Old, No Replies

Declare a Constant within a VB Script Class

....I can't seem to do it?

         

Equiano

5:13 pm on May 21, 2003 (gmt 0)

10+ Year Member



I am declaring a Class as below in VBScript

===========================================

Class clsUser

Private mstrUserFirstName

const COLLETE_LENGTH = 8
....

End Class

===========================================

and I get an error

===========================================

Microsoft VBScript compilation error '800a03ea'

Syntax error

/devarea/test.asp, line 343

const COLLETE_LENGTH = 8
===========================================

pointing to the Const statement. Is declaring a constant inside a class illegal? I have tried prefixing it with Private (and Public) but it does not make any difference.

Any ideas please

Equiano

8:34 am on May 22, 2003 (gmt 0)

10+ Year Member



Just in case anyone else was interested in the answer.

I did a bit of RTFM, not a manual exactly but a WROX book and it turns out it is a bug with VBScript 5.0 and you can't create Constants within VBScript classes.

Now that's something you don't see every day, buggy Microsoft Code. (Just every other day :-))