OpenFileDialog.AutoUpgradeEnabled doesn't work under 7?

Posted by Digiku on Stack Overflow See other posts from Stack Overflow or by Digiku
Published on 2010-05-31T03:36:36Z Indexed on 2010/05/31 3:42 UTC
Read the original article Hit count: 506

If I specify OpenFileDialog.AutoUpgradeEnabled = true, my program still shows the old XP-style dialog. Any idea why this would happen? This is after I enable theming in Main()

[STAThread]
static void Main()
{
    Application.EnableVisualStyles();
    Application.Run(new Primary());
}

and this is my dialog code:

private void OpenProgramFile()
{
    OpenFileDialog programFileDialog = new OpenFileDialog();
    programFileDialog.Filter = "Program files (*.exe;*.lnk)|*.exe|All files (*.*)|*.*";
    programFileDialog.FilterIndex = 0;
    programFileDialog.Title = "Select program file";
    programFileDialog.AutoUpgradeEnabled = true;
    programFileDialog.ShowHelp = true;

    DialogResult fileResult = programFileDialog.ShowDialog();
    if (fileResult != DialogResult.OK)
        return false;

    programFileDialog.Dispose();
}

So why would AutoUpgradeEnabled not work on 7?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET