Announcement

Collapse
No announcement yet.

REDIM in Class Method

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • REDIM in Class Method

    In a class I have an instance variable declared as:

    Code:
    INSTANCE aItems() AS STRING
    I have a Method in the class that calls a Class Method that takes a string value (an Instance variable called lList) and dimensions aItems() using the following code:

    Code:
    REDIM PRESERVE aItems(1 TO PARSECOUNT(lList, "~")) AS STRING
    then populates the array with

    Code:
    PARSE lList, aItems(), "~"
    Within the Class Method, the array is now sized and populated properly (e.g. UBound(aItems()) = 18, array elements have the expected values)

    When I exit the Class Method and return to the calling method, the array is uninitialized (UBound(aItems()) = -1).

    Is this a bug, or am I missing something?
    Anthony W. J. Giambalvo
    Giami Network Services, LLC
    North Plainfield, NJ USA
    Email: anthony dot powerbasic at giami dot com


  • #2
    Just a guess... Have you tried declaring the array as STATIC?

    Comment


    • #3
      Hi Anthony, you have probably solved this by now, but the "AS STRING" part of the REDIM PRESERVE implicitly defines a new local array. If you delete it, I am confident that the problem will go away!

      Comment

      Working...
      X