How To Determine Visual Basic 3.0 Trappable Errors (108340)



The information in this article applies to:

  • Microsoft Visual Basic Standard Edition for Windows 3.0
  • Microsoft Visual Basic Professional Edition for Windows 3.0

This article was previously published under Q108340

SUMMARY

This article demonstrates how you can determine if an error you are receiving from a Visual Basic program is a Visual Basic trappable error or if it coming from another source.

MORE INFORMATION

When you run the VB.exe file, follow these steps to get more information on a specific error:
  1. Stop your program if it is currently running.
  2. Press the F8 key to go from design mode to break mode.
  3. Press CTRL+B to activate the debug window.
  4. Enter the following statement and wait for the error message to appear: Error <error-number>

    For example, type Error 70, and the following error message appears:
    Permission denied
  5. Press F1 to get information from Help on that specific error.

    For example, pressing F1 on Error 70 displays the Permission denied page from the Visual Basic Help.
To generate a list of error messages for Visual Basic 3.0:
  1. Start a new project in Visual Basic. Form1 is created by default.
  2. Add a Label control (Label1) and a CommandButton (Command1) to Form1. Set the Label1 Caption property to Status of Error List.
  3. Add the following code to the Click event for Command1:
       Dim i As Variant
       Dim buf As String
       Label1.Caption = "Error List Started"
       For i = 1 To &H7FFF
         If Error$(i) <> "User-defined error" Then
           buf = buf & Format$(i, "@@@@ ") & Error$(i) & Chr$(13) & Chr$(10)
         End If
       Next
       ClipBoard.Clear
       ClipBoard.SetText buf
       Label1.Caption = "Error List Complete"
    					
  4. On the Run menu, choose Start, or press the F5 key to run the program. Click Command1 and, when the label displays the following error message, then paste the contents of the clipboard into an editor, such as Notepad:
    Error List Complete

REFERENCES

For additional information on trappable errors for newer versions of Visual Basic, click the article number below to view the article in the Microsoft Knowledge Base:

136250 How To Determine Visual Basic Trappable Errors


Modification Type:MinorLast Reviewed:7/1/2004
Keywords:kbDocs kbhowto kbref KB108340