cmoha
cmoha

Reputation: 83

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?

Upvotes: 1

Views: 1889

Answers (4)

Ulf Kristiansen
Ulf Kristiansen

Reputation: 1631

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.

Upvotes: 1

Tiago S
Tiago S

Reputation: 1326

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

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

Upvotes: 0

mohamedHabib
mohamedHabib

Reputation: 196

You just need to assign false to ShowHelp property :

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

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

Upvotes: 0

atlanteh
atlanteh

Reputation: 5835

You can look in here:
http://www.codeproject.com/Articles/19566/Extend-OpenFileDialog-and-SaveFileDialog-the-easy
Just remove the parts you don't need.

Upvotes: 0

Related Questions