This is very odd. I have never had this issue with ShowDialog in C#. For some odd reason when the code developed for 64bit OS tries to show the Printer Dialog it never does it and the DialogResult is “None”. I have debugged it by stepping thru each line and see no clues. I’ve checked the namespace and verified that I set proper references:
using System.IO;
using System.Windows.Forms;
Here’s the code:
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
printDoc.DefaultPageSettings = pgSettings;
PrintDialog dlg = new PrintDialog();
dlg.Document = printDoc;
if (dlg.ShowDialog() == DialogResult.OK)
{
printDoc.Print();
}
}
The exact same code, in an almost identical version for 32 bit machines, has no problem. The dialog is displayed, the user selects a printer, presses OK and the task is complete.
In the 64bit version, the ShowDialog() will not work for PrintDialog() but will work for PrintPreviewDialog()!
Any ideas would be greatly appreciated!
I think this has been answered elsewhere:
http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/a707d202-1a8b-43b1-9fff-08aa7ceb200a/