SaveFileDialog AddExtension doesn't work as expected
I've the following C# code, which is using the SaveFileDialog and set's the AddExtension property to true : var dialog = new SaveFileDialog(); dialog.AddExtension = true; dialog.DefaultExt = "txt"; dialog.Filter = "Text files (*.txt)|*.txt|XML files (*.xml)|*.xml"; dialog.OverwritePrompt = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { label1.Text = dialog.FileName; } And I've tested the following combination of File name and Save as type of the dialog. File name | Save as type | label1.Text | What I expect ----------------+----------------+----------------+----------