Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling 1

Status
Not open for further replies.

Tido

Programmer
Jul 18, 2002
8
0
0
CA
I have a procedure that is communicating with the printer so generally i want to trap all priter errors out of paper for exable or a printer buffer overflow. so i put in this

On Error GoTo CheckError

right after my dim statment and then when errors occured it would halt the program and bring up the default error window display end,debug,help options commonly seen when debuging a vb6 app. what i want it to do is to goto the CheckError code which i put at the bottom of ther procedure before the end sub statement which looks like this.

CheckError: 'Branch here if error occurs
Const cPrinterError = 482
Const cPrinterDriverNotSupported = 483
Const cPrinterConnectionFailed = 484
Const cPrinterCantPrint = 486
If Err.Number = cPrinterError Then
MsgBox "bleh", vbOKOnly, "bleh"
ElseIf Err.Number = cPrinterDriverNotSupported Then
MsgBox "bleh", vbOKOnly, "bleh"
Resume
ElseIf Err.Number = cPrinterConnectionFailed Then
MsgBox "bleh", vbOKOnly, "bleh"
Resume
ElseIf Err.Number = cPrinterCantPrint Then
MsgBox "bleh", vbOKOnly, "bleh"
Resume
End If

even if right after i write on error goto CheckError I do an err.raise(482) (General Printer Error) it does not goto the checkerror routine it just displays the default vb6 error debuging window with the end,debug,help i mentioned before. every help file i have read says todo it this way and i have not enabled error handling anywhere else in my application. Any questions/comments/ideas are very apperciated thanks.
 

Tools>options>general tab. Look for the error trapping frame and make sure that the break in class module or on unhandled errors is selected and click ok and retry.

Good Luck

 
Worked well thanks you just saved me a few billable hourus on msdn ;) i dont know if thats a good or a bad thing ;p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top