vba:: Error No description 에러발생시 숫자코드 설명

 

 

Error Number Default Error Message
5 Procedure call or argument is not valid
6 Overflow
7 Out of memory
11 Division by zero
51 Internal error
52 Bad file name or number
53 File not found
55 File already open
76 Path not found
482 Printer error

 

 

On Error Resume Next
"Statement"
 
 
If Err.Number <> 0 Then 
" statements"
 
'''''''''''''''''''''
 
Imports System
Public Class MainClass
    Shared Sub Main(ByVal args As String())
        Dim I As Integer
        On Error Resume Next
        I = Value()
        Select Case Err.Number
            Case 0
            Case 11
                I = 100
            Case Else
                Console.WriteLine("Error X." & vbCrLf & Err.Description)
                Console.ReadLine()
                Exit Sub
        End Select
        Console.WriteLine("I = " & I)
        Console.ReadLine()
    End Sub
    Private Shared Function Value() As Integer
        Return 1 \ Integer.Parse("0")
    End Function
End Class

 

 

 

 

 

In VB.NET

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
On Error Resume Next
"Statement"
 
 
If Err.Number <> 0 Then 
" statements"
 
'''''''''''''''''''''
 
Imports System
Public Class MainClass
    Shared Sub Main(ByVal args As String())
        Dim I As Integer
        On Error Resume Next
        I = Value()
        Select Case Err.Number
            Case 0
            Case 11
                I = 100
            Case Else
                Console.WriteLine("Error X." & vbCrLf & Err.Description)
                Console.ReadLine()
                Exit Sub
        End Select
        Console.WriteLine("I = " & I)
        Console.ReadLine()
    End Sub
    Private Shared Function Value() As Integer
        Return 1 \ Integer.Parse("0")
    End Function
End Class
cs

 

 

 

 

 

 

_

반응형