Link to home
Start Free TrialLog in
Avatar of mindserve
mindserve

asked on

Cancel print

This just cancels...I need to show the dialog and allow the user to either cancel or print...I am not getting anywhere with this code. Even though this is vb net, the code should be the same or similar in C#

-------------------------------------------------
        PrintFormulas.ShowDialog()

        If CBool(Windows.Forms.DialogResult.Cancel) = True Then

            MsgBox("Printing Canceled")

        Else
            If CBool(Windows.Forms.DialogResult.OK) Then


                PD.Print()
            End If
        End If
ASKER CERTIFIED SOLUTION
Avatar of Ravi Vaddadi
Ravi Vaddadi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If Windows.Forms.DialogResult =  DialogResult.Cancelled Then

            MsgBox("Printing Canceled")

        Else
            If CBool(Windows.Forms.DialogResult.OK) Then


                PD.Print()
            End If
        End If
Avatar of mindserve
mindserve

ASKER

Made some slight changes to your code but it works! ThX

 Dim result As DialogResult
        result = PrintFormulas.ShowDialog()

        If result = Windows.Forms.DialogResult.Cancel Then

            MsgBox("Printing Canceled")

        Else
            If result = Windows.Forms.DialogResult.OK Then


                PD.Print()
            End If
        End If
OOps...accepted the wrong person. Both code works though..should I split the points ..too late now?
You could request attention to the adminstrator and split the points
Ok, will do that
thanks