How To Trim Down a Visual Basic Program to Isolate the Problem

Last reviewed: December 9, 1996
Article ID: Q142975
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

SUMMARY

When you encounter a problem with a Visual Basic program and have to call Microsoft Technical Support for assistance, your call time will be minimized if you can provide a minimal program to reproduce the problem to the support engineer. This article has some tips on how to reduce your Visual Basic program to a minimum so you can accurately describe the problem to a support engineer. The support engineer is looking for a way to duplicate the problem using the least amount of objects and code.

MORE INFORMATION

The following is the basic strategy of creating a minimal Visual Basic program to isolate the problem so a support engineer can find a solution quickly.

  1. Make a back up copy of your program.
2. Follow each step shown in the next section. After completing a step,
   check to see if the problem still exists.
3. Copy the minimal program to a new project and check to see if the
   problem still exists.

Although there are several steps presented, you may not have to do all of them to isolate your problem. However, you may need to modify your code to get the program to compile properly to reproduce the problem.

Steps to Reduce your Program to a Minimum

  1. Remove all forms, code modules, and class modules not used to re-create the problem.

  2. Remove all VBX and OCX controls not used to re-create the problem. Visual Basic prevents any control used by the program from being removed.

  3. Remove all unexecuted code from the remaining forms.

  4. At this point you may be able to remove additional VBX and OCX controls that are not used by the remaining forms.

  5. Remove pieces of code from the remaining procedures that do not appear to be related to the problem.

Repeat this process until you have the smallest possible program. Copy this program to a new project. Try to remove pieces from the original project. For example, if the problem is related to database access, use another database to reproduce the problem, such as BIBLIO.MDB shipping with Visual Basic.

An example of a minimal program used to reproduce a problem resulted when a user called Microsoft Technical Support to troubleshoot an application error that occurred when the program was closed. The minimum program contained one form, one line of code, and no controls.


Additional reference words: 4.00 vb4win vb4all
KBCategory: kbusage kbhowto
KBSubcategory: PrgOther


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: December 9, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.