Diming an array with a constant

Results 1 to 2 of 2

Thread: Diming an array with a constant

  1. #1
    Eric Weidl Guest

    Default Diming an array with a constant

    Hi, I&#039;m new to ASP and VBscript. I&#039;m working through the Sams Teach Yourself ASP book and was trying to tighten up the Calendar.asp code in the Week 1 review. <BR><BR>I was trying to replace the hard-coded numbers with constants. For example, line 61 of listing BP1.5 is:<BR><BR> Dim aCalendarDays(42)<BR><BR>I&#039;d like to replace that with:<BR><BR> Const MAXDAYS = 42<BR> Dim aCalendarDays(MAXDAYS)<BR><BR>but I&#039;m getting an &#039;expected integer constant&#039; error. <BR><BR>Is there some trick to Diming an array with an expression or constant? <BR><BR>advTHANKSance<BR><BR>Eric

  2. #2
    Join Date
    Dec 1969

    Default RE: Diming an array with a constant

    Yeah it is a trick, you must use Redim after initially dimming it to use a number. Probably something to do with allocating memory or something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts