Exemple #1
0
        private void OnExportСsvMenuClickEventRaised(object sender, EventArgs e)
        {
            SaveFileDialog sfd;

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