DOCUMENT:Q150467 24-SEP-1996 [vbwin] TITLE :PRB: Modal Form Flickers When Exiting Form with DBGrid Control PRODUCT :Microsoft Visual Basic for Windows PROD/VER:4.00 | 4.00 OPER/SYS:WINDOWS | WINDOWS NT KEYWORDS:kbprg kbprb ------------------------------------------------------------------------ The information in this article applies to: - Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0 ------------------------------------------------------------------------ SYMPTOMS ======== Under certain circumstances, unloading a form containing a DBGrid control causes Visual Basic to hang and other open forms to flicker. After hiding the third form of the program, the second form flickers or blinks. Under the 16-bit edition of Visual Basic, an application error follows the blinking, and displays the following error message: VB caused a general protection fault in module VB.EXE at 000b:000039f3. CAUSE ===== The problem is limited to the following combination of circumstances: - A project contains at least three forms with each form containing the DBGrid control. - The first form shows a second, modal form. The problem does not occur if the second form is not shown modally. - A single form creates two or more instances of the original form. RESOLUTION ========== There are two possible resolutions to the problem. Either solution prevents the problem from occurring: - Do not show the second form as a modal form. - or - - In the Unload event of the third form, add the following line of code: Me.Enabled = False STATUS ====== This behavior is by design. MORE INFORMATION ================ Steps to Reproduce Problem -------------------------- 1. Create a Visual Basic project with three forms. 2. Add a Command button to Form1. Place the following code in the Click event of the Command button: Form2.Show 1 3. Add a Command button to Form2. Place the following code in the Click event of the Command button: Form3.Show 1 4. Add a DBGrid control to Form3. Run the project. 5. From Form1, click the Command button to show Form2. From Form2, click the Command button to show Form3. Close Form3. Additional reference words: 4.00 vb4win vb4all KBCategory: kbprg kbprb KBSubcategory: PrgCtrlsStd ============================================================================= 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. Copyright Microsoft Corporation 1996.