Article ID: 126731 - Last Review: February 11, 2005 - Revision: 2.1

INFO: VB Programming in VB 3.0

This article was previously published under Q126731
This article covers some of the most Frequently Asked Questions (FAQ) about non-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."
  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 (integer, long, and so forth).

    Additionally, the following will etail more well-known causes of this error:
    100190  (http://support.microsoft.com/kb/100190/EN-US/ ) BUG: Overflow Error When CurrentX Or CurrentY Greater Than 32K
    81953  (http://support.microsoft.com/kb/81953/EN-US/ ) Overflow Error Plotting Points Far Outside Bounds of Control
    74517  (http://support.microsoft.com/kb/74517/EN-US/ ) FIX: Overflow Error If Print Long String to Form or Printer
    106495  (http://support.microsoft.com/kb/106495/EN-US/ ) BUG: VB Printer.Width/Height Values Incorrect for Plotter
    113439  (http://support.microsoft.com/kb/113439/EN-US/ ) PRB: Converting MBF to IEEE in Visual Basic for Windows
    95499  (http://support.microsoft.com/kb/95499/EN-US/ ) BUG: Stack Fault May Occur If Trapping Divide By Zero
    105808  (http://support.microsoft.com/kb/105808/EN-US/ ) BUG: Overflow in VB version 3.0 ICONWRKS Sample Program
  2. Q. Where are the corrections to the manuals listed? A. Get out your red pen and see the following article in the Microsoft Knowledge Base:
    100369  (http://support.microsoft.com/kb/100369/EN-US/ ) Corrections for Errors in Visual Basic Version 3.0 Manuals
  3. Q. How do you tell if a file exists?

    A. Use the DIR$ function.
  4. Q. Now that I found the file, how do I delete it?

    A. Use the KILL$ function.
  5. Q. I'm getting "Illegal Function Call." What's wrong? A. Here is a list of Knowledge Base articles that describe how "Illegal Function Call" (error #5) can be generated:
    113332  (http://support.microsoft.com/kb/113332/EN-US/ ) BUG: AddNew Method Gives Error: Illegal Function Call
    94778  (http://support.microsoft.com/kb/94778/EN-US/ ) BUG: Illegal function call / Division By Zero Errors
    88477  (http://support.microsoft.com/kb/88477/EN-US/ ) PRB: SetFocus During Form Load May Cause Illegal Function Call
    87773  (http://support.microsoft.com/kb/87773/EN-US/ ) PRB: SendKeys May Return Illegal Function Call Error
    84547  (http://support.microsoft.com/kb/84547/EN-US/ ) PRB: DateValue Argument Gives "Illegal Function Call" Error
    Additionally, don't exceed the byte value range of 0 to 255 when dealing with characters. For example, if you add 50 to the extended- ASCII character CHR$(230) and assign it to a string in Basic, you get an "Illegal function call" error.
  6. Q. If I have invisible menus on my form, why do the wrong menus appear when I choose a pop-up menu? A. Visual Basic is not firing the correct menu choice on a pop-up menu for a menu whose visible property is set to False. This has been confirmed to be a bug in Visual Basic 3.0.

    To work around this problem, either:

    Make the first menu on the form visible.

    -or-

    Place all pop-up menus on a separate form. Then you can leave all the menus on your pop-up menus visible, but make the form that contains them invisible. To make the form invisible, set the form's visible property to false. You can invoke pop-up menus from other forms by referring to the form name and then the menu name, as in this example:

    PopupMenu Form2.Menu2

    For additional information, please see the following article in the Microsoft Knowledge Base:
    116058  (http://support.microsoft.com/kb/116058/EN-US/ ) Incorrect Popup Menu Events Fired with Invisible Menus
  7. Q. How can I create a transparent bitmap, or layer multiple bitmaps on top of each other? A. If bitmaps are layered on top of one another, the overlapped regions will not show through the bitmaps that are on top unless the upper bitmap has transparent regions.

    For additional information about creating a transparent bitmap from Visual Basic using Windows APIs, please see the following article in the Microsoft Knowledge Base:
    94961  (http://support.microsoft.com/kb/94961/EN-US/ ) How to Create a Transparent Bitmap Using Visual Basic
  8. Q. How can I find out what corrections have been made to the Visual Basic manuals? A. As the errors are found and reported, they are gathered together into article Q100369 in the Knowledge Base.

    For additional information, please see the following article in the Microsoft Knowledge Base:
    100369  (http://support.microsoft.com/kb/100369/EN-US/ ) Corrections for Errors in Visual Basic Version 3.0 Manuals
  9. Q. I'm getting "Out of Memory" and my machine has XX megabytes free, what's wrong? A. "Out of Memory" is typically one of two problems. First, you may have exceeded the limits of one of Visual Basic's internal 64K tables. Second, "Out of Memory" seems to be a catchall error for other, less specific problems.

    To prevent legitimate "Out of Memory" messages consult with Appendix D (Specifications and Limitations) and Chapter 11 (Optimizing Your Application for Size and Speed) in the "Programmer's Guide." Then consult article 112860  (http://support.microsoft.com/kb/112860/EN-US/ ) (General Memory Management in Visual Basic Vers 3.0 for Windows), which was written in conjunction with the developer who implemented VB's memory management, and discusses how to deal with this issue.

    For the other case, consult the following Knowledge Base articles as known sources of the "Out of Memory" error when the cause may not be an actual memory leak.

    For additional information, please see the following articles in the Microsoft Knowledge Base:
    97136  (http://support.microsoft.com/kb/97136/EN-US/ ) BUG: OLE DataText Prop Doesn't Free Memory When Object Closed
    103438  (http://support.microsoft.com/kb/103438/EN-US/ ) BUG: Out of Memory w/ MSOLE2.VBX When SHARE.EXE Not Loaded
    107769  (http://support.microsoft.com/kb/107769/EN-US/ ) PRB: Out of Memory Error Using VB Outline Control
    113031  (http://support.microsoft.com/kb/113031/EN-US/ ) BUG: ActiveControl Property of Screen Object Loses Memory
    110989  (http://support.microsoft.com/kb/110989/EN-US/ ) BUG: Out of Memory Error When Adding 35-50 Pen Controls
    113031  (http://support.microsoft.com/kb/113031/EN-US/ ) BUG: ActiveControl Property of Screen Object Loses Memory
    102069  (http://support.microsoft.com/kb/102069/EN-US/ ) BUG: Out of Memory w/ Var Named ClientLeft/Top/Width/Height
    76983  (http://support.microsoft.com/kb/76983/EN-US/ ) BUG: FormName Not in Correct Order After Out of Memory Error
  10. Q. How do I capture/print a picture control with embedded controls and graphics? A. Article 85978  (http://support.microsoft.com/kb/85978/EN-US/ ) offers a very handy routine called PrintWindow(). In the context of the article, PrintWindow() is used to print a form's client area to a printer. However PrintWindow() does not really care much about the source of the image or the destination. All it requires is a hWnd (window handle) property from the source, and a hDC (device context) and the ability to receive a bitmap for the destination.

    Therefore, you can use PrintWindow() to capture an image of a picture control with embedded controls and graphics into either a printer object, or to another picture control.

    For additional information, please see the following article in the Microsoft Knowledge Base:
    85978  (http://support.microsoft.com/kb/85978/EN-US/ ) Print Form or Client Area to Size on PostScript or PCL Printer
  11. Q. How can I be sure that all my forms are unloaded correctly? A. You can use the following code in the unload event of the form that has triggered your applications exit:
           Dim i%
           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...
           End
     
  12. Q. How do I make my Visual Basic app Windows '95 logo compliant?

    A. A difficult task prior to Win '95 shipping, but there are some things you can do to move into the right direction. The Microsoft Windows logo department has prepared a mailing on the Windows logo transition. You may access this document by calling the faxback service at (800) 426-9400. Choose option 2 for Developer Solutions, then option 1 for the faxback service, then press 1 for a complete index of available documents. Or choose document #130 for specific information on the Windows '95 logo program.
  13. Q. How do I make my Visual Basic app Office-compatible?

    A. This is a program that is available to Independent Software Vendors. You can call to find out what is required by ordering the Microsoft Office Compatible Information Kit (Order Part Number 098-55847) at (800) 426-9400.
  14. Q. How can I find out if a file exists in a given path? A. Article 112674  (http://support.microsoft.com/kb/112674/EN-US/ ) shows how do check if a file exists by using the DIR$ command.

    For additional information, please see the following article in the Microsoft Knowledge Base:
    112674  (http://support.microsoft.com/kb/112674/EN-US/ ) How to Determine If a File Exists by Using DIR$
Expand all | Collapse all

APPLIES TO
  • Microsoft Visual Basic 3.0 Professional Edition
Keywords: 
kbfaq kbinfo KB126731
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations