FIX: EXE Crashes When For...Each Loop Iterates Through Array Returned by Property Get ProcedureID: Q223113
|
When using a For...Each loop to iterate through an array that was returned from a Property Get procedure, you receive the following error message:
NOTE: The error occurs when the code is called from an EXE that was compiled to native code, but does not occur when called from an EXE that was compiled to p-code. The error does not occur when you execute the code in the Visual Basic IDE.The instruction at "0x6610d3b1" referenced memory at "0x00131004". The memory could not be "read".
You can work around the problem using one of the following alternative methods:
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio 6.0 Service Packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
Private sSeasons() As String
Property Get SeasonsProp() As String()
SeasonsProp = sSeasons
End Property
Private Sub Form_Initialize()
ReDim sSeasons(3)
sSeasons(0) = "Spring"
sSeasons(1) = "Summer"
sSeasons(2) = "Autumn"
sSeasons(3) = "Winter"
End Sub
Private Sub Form_Load()
Dim x As Variant
Dim fForm1 As Form1
Set fForm1 = New Form1
MsgBox "Before arrays"
For Each x In fForm1.SeasonsProp
MsgBox "Item: " + x
Next
End Sub
Private Sub Form_Load()
Dim x As Variant
Dim fForm1 As Form1
Dim sTemp() As String
Set fForm1 = New Form1
sTemp = fForm1.SeasonsProp
MsgBox "Before arrays"
For Each x In sTemp
MsgBox "Item: " + x
Next
End Sub
Additional query words:
Keywords : kbservicepack kbCompiler kbVBp600bug kbGrpVB kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 20, 1999