CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Cancel print

  1. #1
    Join Date
    May 1999
    Location
    Bogotá, Colombia
    Posts
    37

    Cancel print

    I use the following code to print an MSChart


    private Sub cmdPrint_Click()

    on error GoTo Printer_Error

    CommonDialog1.ShowPrinter

    MSChart1.EditCopy
    frmGraficarPorCaso.Picture1.Picture = Clipboard.GetData()
    Printer.print " "
    Printer.PaintPicture frmGraph.Picture1.Picture, _
    0, 0, Printer.Width - 1, Printer.Height - 1
    Printer.EndDoc

    Exit Sub

    Printer_Error:
    MsgBox "Printer error." & Chr(13) & Chr(10) & _
    Chr(13) & Chr(10) & Err.Description, vbCritical
    End Sub




    but whenever I press Cancel on the common dialog the chart prints anyway. What do i need to do to stop this?

    Thanks,

    Andrew


  2. #2
    Join Date
    Nov 1999
    Posts
    18

    Re: Cancel print

    There is nothing wrong with your code, Andrew, but you must set:


    CmDiag1.CancelError = true



    for the CommonDialog to tell you the user has pressed cancel.

    Regards,
    psiclone


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