Redim Arrarys using variables

Results 1 to 2 of 2

Thread: Redim Arrarys using variables

  1. #1
    Todd Fulmino Guest

    Default Redim Arrarys using variables

    I am tring to Redim an array using a predefined variable, but I keep running into problems.<BR><BR>Is the following code legal?<BR><BR>Dim intNumber<BR>Dim arrUsers()<BR><BR>intNumber = 5<BR>Redim Preserve arrUsers(intNumber)<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Redim Arrarys using variables

    Yes. Its Legal and it works<BR><BR>I wrote a small test code by just extending the code you wrote. <BR>********************************************** **********<BR>Dim intNumber <BR>Dim arrUsers() <BR><BR>intNumber = 5 <BR>Redim Preserve arrUsers(intNumber) <BR>arrUsers(0) = "H"<BR>arrUsers(1) = "E"<BR>arrUsers(2) = "L"<BR>arrUsers(3) = "L"<BR>arrUsers(4) = "O"<BR><BR>for i=0 to Ubound(arrUsers)<BR> Response.write arrUsers(i)<BR>next <BR><BR>*****************************************< BR>This code displays "HELLO"<BR>It works perfectly fine.<BR><BR>What is the problem you are facing?

Posting Permissions

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