Skip to content

Instantly share code, notes, and snippets.

@xanathar
Created June 3, 2014 16:49
Show Gist options
  • Save xanathar/73faf20b3ecf062262c4 to your computer and use it in GitHub Desktop.
Save xanathar/73faf20b3ecf062262c4 to your computer and use it in GitHub Desktop.
Quick reminder of WinForms standard file dialogs
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Title = "Save on XML";
sfd.OverwritePrompt = true;
sfd.DefaultExt = "xml";
sfd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
if (sfd.ShowDialog() == DialogResult.OK)
{
...
}
}
{
OpenFileDialog sfd = new OpenFileDialog();
sfd.Title = "Load from";
sfd.DefaultExt = "xml";
sfd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
if (sfd.ShowDialog() == DialogResult.OK)
{
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment