PRB: GPF in VBA2.DLL Accessing Collection in Local ClassLast reviewed: June 19, 1997Article ID: Q170357 |
The information in this article applies to:
SYMPTOMSWith the 16-bit version of Microsoft Visual Basic 4.0, if you attempt to access a collection of a class, you may receive one of the following errors. When running in Microsoft Windows 3.11 or Microsoft Windows For Workgroups 3.11, the error will say:
"VB caused a General Protection Fault in module VBA2.DLL" -or- "Run-time Error 9: Subscript Out of Range"When running in Microsoft Windows 95, the dialog box will report:
"An error has occurred in your program"After clicking the "Ignore" button several times, another dialog box will report:
"Run time error '5': Invalid procedure call"When running in Microsoft Windows NT:
"An error has occurred in your application"After clicking "Ignore" twice, you will see:
"Run time error '458' Variable uses an OLE type not supported in Visual Basic" CAUSEThis error will occur under the following circumstances:
RESOLUTIONTo work around this problem, explicitly instantiate the collection. For example, if you are receiving one of the errors described above with the following code:
Public MyCollection As New Collection Private Sub Class_Initialize() MyCollection.Add "Hello" End SubChange the code to look like the following:
Public MyCollection As Collection Private Sub Class_Initialize() Set MyCollection = New Collection MyCollection.Add "Hello" End Sub STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional query words: gpf vb4 16bit 16 bit 0005:1E3A 0005:1B21 0005:2027
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |