private void OnFindOldProductsMenuClickEventRaised(object sender, EventArgs e) { SaveFileDialog sfd; sfd = new SaveFileDialog() { Filter = "CSV (.csv)|*.csv", ValidateNames = true }; if (sfd.ShowDialog() == DialogResult.OK) { StringBuilder sb = facade.ExportOldPRoductsToCsvFile(); StreamWriter sw = new StreamWriter(new FileStream(sfd.FileName, FileMode.Create), Encoding.UTF8); sw.WriteLine(sb); sw.Close(); sw.Dispose(); MessageBox.Show("Експорт завершено."); } }