Microsoft KB Archive/223107

From BetaArchive Wiki

Article ID: 223107

Article Last Modified on 12/6/2004



APPLIES TO

  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition



This article was previously published under Q223107

SYMPTOMS

A class module in a Standard EXE project contains a declaration for a public event. A form in the Standard EXE project instantiates an object variable based on the class module with the WithEvents keyword. When you delete the declaration statement for the object variable in the code window of the form and select the object variable from the object box of the code window, an application error occurs.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For additional information about Visual Studio 6.0 service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 Visual Studio 6.0 service packs, what, where, why


194295 How to tell that Visual Studio 6.0 service packs are installed


MORE INFORMATION

This section shows you how to create a sample project that demonstrates the bug behavior. The section assumes you are familiar with adding a class module to a Standard EXE project and instantiating the COM object from that Class module. If you are not familiar with these tasks, see the REFERENCES section for more information on these tasks.

Steps to reproduce the behavior

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add a class module to the project. Class1 is created by default.
  3. Copy the following code to the Code window of Class1:

    Option Explicit
    Public Event MyCustomEvent()
        
                        
  4. Copy the following code to the Code window of Form1:

    Option Explicit
    Private WithEvents X As Class1
        
                        
  5. Delete the following line from the Code window of Form1:

    Private WithEvents X As Class1
                        
  6. In the Object box of Form1, select X.
    BUG: An application error occurs.


REFERENCES

For more information about form, standard, and class modules, see the following Microsoft Developer Network Web sites:

Programming with objectshttp://msdn.microsoft.com/library/devprods/vs6/vb/html/vbconprogrammingwithobjects.htm


Keywords: kbbug kbfix kbactivexevents kbvs600sp3fix KB223107