ShowDialog() gets no DialogResult

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!

Answers


I think this has been answered elsewhere:

http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/a707d202-1a8b-43b1-9fff-08aa7ceb200a/

Try setting USEExDialog = True - It should work.


Need Your Help

Print even numbers with Range() in LINQ

c# linq

I'm trying to print even numbers from 1 to 10 using LINQ with the following code

Significant whitespace in C# like Python or Haskell?

c# python haskell

I'm wondering if any other C# developers would find it an improvement to have a compiler directive for csc.exe to make whitespace significant a la Haskell or Python where the kinds of whitespace cr...