Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/105140

From BetaArchive Wiki
Knowledge Base


Article ID: 105140

Article Last Modified on 10/28/2003



APPLIES TO

  • Microsoft Visual Basic 3.0 Professional Edition
  • Microsoft Visual Basic 3.0 Professional Edition



This article was previously published under Q105140

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 query words: buglist3.00 fixlist4.00 3.00 UAE GPF

Keywords: kbbug kbfix KB105140