FAQ: Visual Basic Programming in Visual Basic 4.0

Last reviewed: August 21, 1996
Article ID: Q142251
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

This article covers some of the most Frequently Asked Questions (FAQs) about technical issues for Microsoft Visual Basic for Windows. You can find this and other FAQ articles by querying on the keyword "FAQ." You can find additional general references in the Microsoft Knowledge Base by searching on "article list."

MORE INFORMATION

1. Q. I'm getting error #6 "Overflow." What's wrong?

   A. The most common cause of an overflow error is exceeding the upper or
      lower bounds of either the type of a data variable or the limits of
      the property for an object.

      Query on "Data Types" in the Visual Basic Online Help to determine
      the upper and lower bounds for various data types, such as integer or
      long.

      Other causes of this error are documented in the following
      Knowledge Base articles.

      ARTICLE-ID: Q129803
      TITLE     : Variable Coercion Rules in Visual Basic Version 4.0

      ARTICLE-ID: Q129709
      TITLE     : PRB: Overflow Error at Run Time w/Byte Type Counter in
                  For Loop

2. Q. How can you determine if a file exists on a drive?

   A. Use the Dir function. The Dir function returns the name of a file or
      directory that matches a specified pattern or file attribute or the
      volume label of a drive. For more information on the Dir function,
      query on "Dir" in the Visual Basic Online Help, or see the following
      article in the Microsoft Knowledge Base:

      ARTICLE-ID: Q112674
      TITLE     : How to Determine If a File Exists by Using DIR$

3. Q. Now that I found the file, how do I delete it?

   A. Use the Kill statement. The Kill statement deletes the specified
      pathname and file from a disk. If you try to use the Kill statement
      to delete an open file, an error occurs. To delete directories, use
      the RmDir statement.

      For more information on the Kill statement, query on "Kill" in the
      Visual Basic Online Help.

4. Q. I'm getting "Illegal Function Call." What's wrong?

   A. The following are some situations that can generate an Illegal
      Function call:

      CAUSE:      Function does not exist in the program.
      RESOLUTION: Make sure that the function exists in the program and
                  that the function is accessible to the form or procedure
                  calling the function. Place the function in a module to
                  allow access by any part of your program. Make sure that
                  the function name in the calling procedure matches the
                  name of the function.

      CAUSE:      Wrong number of parameters passed to the function.
      RESOLUTION: Check that the correct number of parameters is passed to
                  the function.

      CAUSE:      Wrong parameter type is passed to the function.
      RESOLUTION: Check that the parameter being passed to the function is
                  the type that the function expects. For example, passing
                  an integer parameter to a function expecting a string
                  results in this error.

      CAUSE:      Byte range for a character exceeded.
      RESOLUTION: Check that the byte value of a character is between 0 and
                  255. For example, if you add 50 to the extended-ASCII
                  character CHR(230) and assign it to a string in Visual
                  Basic, the result is an "Illegal function call" error.

      Another cause of this error is documented in the following
      Knowledge Base article:

      ARTICLE-ID: Q142937
      TITLE     : How to Prevent Multiple Instances of a VB Application

6. Q. How can I be sure that all my forms are unloaded correctly?

   A. Use the following code in the Unload event of the form that has
      triggered your applications exit:

      Dim i as integer
      While forms.Count > 1

         ' Find first form besides "me" to unload
         i = 0
         While forms(i).Caption = Me.Caption
            i = i + 1
         Wend
         Unload forms(i)
      Wend

      ' Last thing to be done...
      Unload Me
      End

7. Q. Where are the corrections to the manuals listed?

   A. Get out your red pen and query the Knowledge Base using the "vb4win"
      and "kbdocerr" keywords for a list of documentation errors.

8. Q. How do I make my Visual Basic program Windows 95 logo compliant?

   A. Request a pre-testing kit from the Windows Logo Department from
      the following sources:

      E-mail:   winlogo@microsoft.com
      Fax:      (206) 936-7329, Attn: Windows Logo Department
      Phone:    (206) 936-2880
      Mail:     Microsoft Corporation
                Attn: Windows Logo Department
                Bldg. 20
                Redmond, WA 98052- 6399

      This kit provides all the information about requirements to display
      the Windows 95 logo on your program. For more information on the
      Windows Logo Program, see the following web site:

      http://www.microsoft.com/windows/thirdparty/winlogo


Additional reference words: 4.00 vb4win vb4all faq fax back
KBCategory: kbref 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: August 21, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.