private void saveButton_Click(object sender, EventArgs e) { string localPath = System.IO.Directory.GetCurrentDirectory(); SaveFileDialog SaveFileDialog1 = new SaveFileDialog { FileName = "settings", Filter = (@"Text Files (*.txt)|*.txt"), DefaultExt = "txt", AddExtension = true, InitialDirectory = localPath }; DialogResult result = SaveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { string filePath = SaveFileDialog1.FileName; IOstrobe output = new IOstrobe(); output.SaveData(_settings, filePath); } }