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
LVL 1
mindserveAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SriVaddadiCommented:
Dim result as DialogResult
result =  PrintFormulas.ShowDialog()

        If result == DialogResult.Cancelled Then

            MsgBox("Printing Canceled")

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


                PD.Print()
            End If
        End If
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vikas413Commented:
If Windows.Forms.DialogResult =  DialogResult.Cancelled Then

            MsgBox("Printing Canceled")

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


                PD.Print()
            End If
        End If
0
mindserveAuthor Commented:
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
0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

mindserveAuthor Commented:
OOps...accepted the wrong person. Both code works though..should I split the points ..too late now?
0
SriVaddadiCommented:
You could request attention to the adminstrator and split the points
0
mindserveAuthor Commented:
Ok, will do that
0
SriVaddadiCommented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.