BugWinFormsSaveFileDialog/BugSaveFileDialog/Form1.cs

34 lines
993 B
C#
Raw Permalink Normal View History

2022-05-26 15:21:16 +00:00
namespace BugSaveFileDialog
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var saveDialog = new SaveFileDialog
{
AddExtension = true,
CheckPathExists = false,
CheckFileExists = false,
CreatePrompt = false,
OverwritePrompt = true,
DereferenceLinks = true,
DefaultExt = "my",
Filter = "My files (*.my)|*.my",
RestoreDirectory = true,
Title = "Create a my file",
};
var dialogResult = saveDialog.ShowDialog(this);
if (dialogResult == DialogResult.OK)
{
var filePath = saveDialog.FileName;
MessageBox.Show(filePath);
}
}
}
}