CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    49

    Printer return error codes

    I tried to search for it but all were attempt to make a use of the printer.

    What I need is something to trap the printer errors. In our app, if the user clicks on the Print button and then they expect a print out to the default printer.

    Well, don't ask me why! The stupid user disconnected the printer and then attempts to print to the printer, the error code is returned and then the application freezes.

    For reasons unknown, I could only think that the user is trying to test our application that if it functions like MS Office. If you attempt to print something in Office app, MS gracefully traps the error and informs the user and it does not crash or freeze the application. Regardless that you have a printer defined in Control Panel's Printer applet, how do you trap errors and anyone know the error code numbers for possible different situations.

    We have to fix this.

    Thanks.

  2. #2
    Join Date
    Mar 2002
    Location
    Holland
    Posts
    279
    What kind of errors do you get?

    does the software crash?

    have you tried on error goto ..... ?

    some sample code for on error

    sub print()

    'enable error handeling
    on error goto printererror

    printer.print "XYZ"

    'kill the error handeling
    on error goto 0

    exit sub

    printererror:
    msgbox("He printer error")

    end sub

    Hope it helps,

    Jewe

    A VB programmer trying to stay alive in a Real C World

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured