Microsoft KB Archive/108340: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - ">" to ">")
Line 57: Line 57:
<li>Press the F8 key to go from design mode to break mode.</li>
<li>Press the F8 key to go from design mode to break mode.</li>
<li>Press CTRL+B to activate the debug window.</li>
<li>Press CTRL+B to activate the debug window.</li>
<li>Enter the following statement and wait for the error message to appear:<span class="kbd userinput"> Error <error-number&gt;</span><br />
<li>Enter the following statement and wait for the error message to appear:<span class="kbd userinput"> Error <error-number></span><br />
<br />
<br />
For example, type <span class="kbd userinput"> Error 70</span>, and the following error message appears:
For example, type <span class="kbd userinput"> Error 70</span>, and the following error message appears:
Line 78: Line 78:
   Label1.Caption = "Error List Started"
   Label1.Caption = "Error List Started"
   For i = 1 To &amp;H7FFF
   For i = 1 To &amp;H7FFF
     If Error$(i) <&gt; "User-defined error" Then
     If Error$(i) <> "User-defined error" Then
       buf = buf &amp; Format$(i, "@@@@ ") &amp; Error$(i) &amp; Chr$(13) &amp; Chr$(10)
       buf = buf &amp; Format$(i, "@@@@ ") &amp; Error$(i) &amp; Chr$(13) &amp; Chr$(10)
     End If
     End If

Revision as of 17:44, 20 July 2020

Knowledge Base


How To Determine Visual Basic 3.0 Trappable Errors

Article ID: 108340

Article Last Modified on 7/1/2004



APPLIES TO

  • Microsoft Visual Basic 3.0 Professional Edition
  • Microsoft Visual Basic 3.0 Professional Edition



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



Additional query words: 70

Keywords: kbhowto kbref kbdocs KB108340