EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB 6 Error Handling Error Handling Example

Error Handling Example

E-mail Print

Private Sub Command1_Click()
On Error GoTo ErrorHandler
Error 424 'This error is displayed when there is a missing object
Exit Sub
ErrorHandler:
MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description
End Sub


Private Sub Command2_Click()
On Error GoTo ErrorHandler
Error 424
Exit Sub
ErrorHandler:
If Err.Number = 424 Then
MsgBox "A missing object in your form is needed!, Please refer to the code and arrang
Else: MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Descr
End If
End Sub


Private Sub Command3_Click()
On Error Resume Next
Error 424 'This error is displayed when there is a missing object
MsgBox "error ignored!"
End Sub

Last Updated on Monday, 21 December 2009 16:56