VS 2015 C# - Unable to close Print Preview Dialog box after printing

  • Thread starter Thread starter JC Carmo
  • Start date Start date
J

JC Carmo

Guest
Greetings everyone,

I'm developing a VS 2015 C# WinForms application with MySQL and ran into a very annoying issue in regards to printing my form. The form prints perfectly, exactly the way I want, but I've tried everything to make the Print Preview Dialog box close after printing, but to no avail. Any suggestions? I really appreciate your time and help!

Best regards,

JC

Here's the code:


private void printButton_Click(object sender, EventArgs e)
{
printButton.Visible = false;
printDocument1.DefaultPageSettings.Landscape = true;
CaptureScreen();
printDialog1.AllowSelection = true;
printDialog1.AllowSomePages = true;

if (printDialog1.ShowDialog() == DialogResult.OK)
{
if (printPreviewDialog1.ShowDialog() == DialogResult.OK)
{

printPreviewDialog1.Close();

printButton.Visible = true;
}
}
}



jcrcarmo

Continue reading...
 
Back
Top