FIX: Erase Won't Clear Contents of Huge Fixed Array as Variant (99457)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q99457 SYMPTOMS
The Erase statement fails to erase huge static arrays of type Variant. This
problem occurs with the Variant data type only.
The problem does not occur if the size of the array is less than 64K or if
you use a huge dynamic array of type Variant.
CAUSE
This problem occurs with huge static arrays of the variant data type. An
array is static when you dimension it with the Static keyword or if you
use the DIM keyword to dimension the array in the general-declaration
section of a form or module.
The problem occurs because the Erase statement corrupts the array
descriptor for a huge static array of variants. However, only the
references to the 64K data segments other than the first segment are
corrupted. Any elements in the first 64K segment of the array are always
erased properly. All elements stored in other segments are not erased.
The Erase statement is only effective the first time you erase the elements
of a huge static variant array. Any additional attempt to Erase elements
of the array will fail and the elements in the array in data segments other
than the first segment will not be erased.
WORKAROUND
To work around the problem, clear each element of the array manually by
setting each element to Empty. Replace the "Erase a" statement in step 2
shown below with this code:
For i% = 0 to 5000
a(i%) = Empty '** Empty = 0
Next i%
STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic
version 2.0 for Windows. This problem was corrected in Microsoft Visual
Basic version 3.0 for Windows.
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | kbbug kbfix KB99457 |
---|
|