'ReDim' cannot change the number of dimensions of an array

Last post 06-30-2009 10:12 AM by David Anton. 2 replies.

Sort Posts:

  • 'ReDim' cannot change the number of dimensions of an array

    06-30-2009, 5:21 AM
    • Member
      30 point Member
    • ryanlcs
    • Member since 05-17-2007, 1:35 PM
    • Posts 242

    Hi...

    I have an array declared:

    Dim XAxis_Value()

    and a ReDim statement.

    ReDim XAxis_Value(nCharts, countRec)

    This statement works fine in ASP, but when I switch to ASP.Net, it give errors 'ReDim' cannot change the number of dimensions of an array.

    Any Idea?

  • Re: 'ReDim' cannot change the number of dimensions of an array

    06-30-2009, 6:57 AM
    Answer
    • Participant
      1,066 point Participant
    • stevew1975
    • Member since 05-29-2009, 2:51 PM
    • Bristol, UK
    • Posts 189

    see this link.

    http://msdn.microsoft.com/en-us/library/ttyw2sec.aspx

    You are now unable to do this. 

    You can do

    Dim arr(1,1)

    Redim arr(2,2)

    but not

    dim arr(1)

    redim arr(2,2)




    Please mark this post as answered if it helped you!
  • Re: 'ReDim' cannot change the number of dimensions of an array

    06-30-2009, 10:12 AM
    Answer
    • Contributor
      2,394 point Contributor
    • David Anton
    • Member since 06-12-2005, 5:59 PM
    • Posts 431

     Just let the compiler know that you're dealing with a 2-dimensional array up front:

    Dim XAxis_Value(,)

    David Anton
    Convert between VB, C#, C++, & Java
    http://www.tangiblesoftwaresolutions.com
Page 1 of 1 (3 items)