Search code examples
c#winformsuser-interfaceopenfiledialogsavefiledialog

Old style of Open/Save file dialog


I wonder how to display old style Open/Save file dialog in WinForms

this image is from VCE simulator , you can see there's no help button under Cancel button

enter image description here

I use this code to display the old style

        var sfd = new SaveFileDialog();
        sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
        sfd.ShowHelp = true;

        if ( sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK )
        {
            // Save document 
        }

enter image description here

but I don't want to display help button as it will not help you any way

I tried to switch my target .NET to 3.5, but still displays the new style

please help, am I missing some thing or what?


Solution

  • Try setting AutoUpgradeEnabled to false instead of ShowHelp

    var sfd = new SaveFileDialog();
    sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
    sfd.AutoUpgradeEnabled = false;
    
    if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        // Save document 
    }
    

    MSDN says:

    If this property is false, the FileDialog class will have a Windows XP-style appearance and behavior on Windows Vista.

    But on my system it works for Windows 7 as well.