Question

Okay, in my program I am showing a printDialog and I want to be able to know if the user clicks the print button, or the cancel button. In all the examples online that I've seen, the printDialogs have OK buttons, instead of Print buttons.

For Example (code from msdn) :

System::Windows::Forms::DialogResult result = printDialog1->ShowDialog();
if ( result == ::DialogResult::OK )
{
   //printing code here
}

So without an OK button obviously this code is not going to work.

Anybody know how to tell if print button is clicked?

Was it helpful?

Solution

The "Print" button returns DialogResult::OK so it is safe to check against that value.

In fact any of the dialogs that inherit from CommonDialog will return OK for success.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top