INFO: VB Programming in VB 3.0

ID: Q126731


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for Windows, version 3.0

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?


  2. 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:
    Q100190 BUG: Overflow Error When CurrentX Or CurrentY Greater Than 32K
    Q81953 Overflow Error Plotting Points Far Outside Bounds of Control
    Q74517 FIX: Overflow Error If Print Long String to Form or Printer
    Q106495 BUG: VB Printer.Width/Height Values Incorrect for Plotter
    Q113439 PRB: Converting MBF to IEEE in Visual Basic for Windows
    Q95499 BUG: Stack Fault May Occur If Trapping Divide By Zero
    Q105808 BUG: Overflow in VB version 3.0 ICONWRKS Sample Program
  3. Q. Where are the corrections to the manuals listed?


  4. A. Get out your red pen and see the following article in the Microsoft Knowledge Base:
    Q100369 Corrections for Errors in Visual Basic Version 3.0 Manuals
  5. Q. How do you tell if a file exists?

    A. Use the DIR$ function.


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

    A. Use the KILL$ function.


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


  8. A. Here is a list of Knowledge Base articles that describe how "Illegal Function Call" (error #5) can be generated:
    Q113332 BUG: AddNew Method Gives Error: Illegal Function Call
    Q94778 BUG: Illegal function call / Division By Zero Errors
    Q88477 PRB: SetFocus During Form Load May Cause Illegal Function Call
    Q87773 PRB: SendKeys May Return Illegal Function Call Error
    Q84547 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.
  9. Q. If I have invisible menus on my form, why do the wrong menus appear when I choose a pop-up menu?


  10. 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:
    Q116058 Incorrect Popup Menu Events Fired with Invisible Menus
  11. Q. How can I create a transparent bitmap, or layer multiple bitmaps on top of each other?


  12. 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:
    Q94961 How to Create a Transparent Bitmap Using Visual Basic
  13. Q. How can I find out what corrections have been made to the Visual Basic manuals?


  14. 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:
    Q100369 Corrections for Errors in Visual Basic Version 3.0 Manuals
  15. Q. I'm getting "Out of Memory" and my machine has XX megabytes free, what's wrong?


  16. 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 Q112860 (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:
    Q97136 BUG: OLE DataText Prop Doesn't Free Memory When Object Closed
    Q103438 BUG: Out of Memory w/ MSOLE2.VBX When SHARE.EXE Not Loaded
    Q107769 PRB: Out of Memory Error Using VB Outline Control
    Q113031 BUG: ActiveControl Property of Screen Object Loses Memory
    Q110989 BUG: Out of Memory Error When Adding 35-50 Pen Controls
    Q113031 BUG: ActiveControl Property of Screen Object Loses Memory
    Q102069 BUG: Out of Memory w/ Var Named ClientLeft/Top/Width/Height
    Q76983 BUG: FormName Not in Correct Order After Out of Memory Error
  17. Q. How do I capture/print a picture control with embedded controls and graphics?


  18. A. Article Q85978 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:
    Q85978 Print Form or Client Area to Size on PostScript or PCL Printer
  19. Q. How can I be sure that all my forms are unloaded correctly?


  20. 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
      
  21. 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.


  22. 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.


  23. Q. How can I find out if a file exists in a given path?


  24. A. Article Q112674 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:
    Q112674 How to Determine If a File Exists by Using DIR$

SUMMARY

Additional query words:

Keywords : kbVBp300 kbDSupport
Version : WINDOWS:3.0
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: July 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.