FIX: GPF in VB.EXE at 0038:3B6F w/ Compile-Time Error & Set

Last reviewed: October 30, 1997
Article ID: Q105140
3.00 WINDOWS kbenv kbbuglist

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, version 3.0

SYMPTOMS

When you try to run a program within the development environment, a general protection (GP) fault occurs immediately in module VB.EXE at 0038:3B6F.

CAUSE

The problem can occur when there is a compile-time error (such as a syntax error) followed by a Set statement where the left hand side of the Set is not a simple object variable. The compile-time error does not have to involve an object variable. Examples of object variables that are not simple are object arrays and nested OLE objects.

   Static a(10) As Form
   Set a(i) = Form1      ' setting an object array element

   Static b As Object
   Set b = CreateObject(...)
   Set b.c = ...         ' setting an object variable within an object

WORKAROUND

Find and correct the compile-time error. This takes some effort because the GP fault occurs before VB.EXE shows the location of the error. To narrow down the search for the statement causing the error, remove Set statements from your code until the GP fault no longer occurs. Then correct all compile-time errors, and put the Set statements back in.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Visual Basic version 4.0 for Windows.

MORE INFORMATION

The following code reproduces the problem:

   Sub Form_Load ()
      Static a(0) As Form
      Print 1 >= "a"        ' type-mismatch error
      Set a(0) = Nothing
   End Sub


Additional reference words: buglist3.00 fixlist4.00 3.00 UAE GPF
KBCategory: kbenv kbbuglist
KBSubCategory: EnvtDes
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.