FIX: VB Painting Problem Occurs When Low on System Resources

ID: Q93436


The information in this article applies to:


SYMPTOMS

Painting problems can occur if you have a large project with many forms, or you have a small project and are low on system resources at the time the small project is loaded.


CAUSE

These painting problems occur in the Visual Basic programming environment. They usually occur after the environment displays an "Out of Memory" error. This error may mean that your system is very low on system resources and the Visual Basic for Windows programming environment is unable to use any additional system resources to paint the next form or control.

An "Out of Memory" error can occur while coding in the design mode if you place too much code or text into a module or form; there is a limit of 64K of code for each form and module. Or it can occur if you try to add another form or control to a project and are too low on system resources to perform the operation.


WORKAROUND

It is a good idea to stop adding forms, controls, or code once you get this error while the environment is in design mode. You need to close some of your other Windows applications or reduce the number of forms or controls that take up resources. A way to obtain the amount of available resources is to check the About Program Manager... dialog box in the Help menu of the Program Manager. This dialog box displays a percentage of the system resources; if the percentage is getting below 10% or so, you are getting close to receiving an "Out of Memory" error in the Visual Basic for Windows programming environment.


STATUS

Microsoft has confirmed this to be a problem in the Standard and Professional Editions of Microsoft Visual Basic for Windows, version 2.0. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.


MORE INFORMATION

Steps to Reproduce Problem

  1. Start VB.EXE.


  2. Press the far left button on the Title Bar that contains a picture resembling a form icon and Form2 should display.


  3. Repeat step 2 until you get an "Out of Memory" error. Note that the number of forms that can be displayed before getting this error depends on the amount of free system resources that you started with.


  4. Once you get this error, try to bring up the Menu Design Windows, by selecting the Window menu. Or try to move the Toolbox, Title Bar or other Windows that are part of the Visual Basic for Windows programming environment. Moving any of these tools may result in a painting problem.


  5. Visual Basic for Windows tries to continue working even after the "Out of Memory" error occurs which ends up causing the painting problem. The painting problem occurs because Windows has no resources to give to the Visual Basic for Windows programming environment to perform a repaint of the screen.


Additional query words: buglist2.00 fixlist3.00 2.00 3.00


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: June 17, 1999