コード例 #1
0
        private void ImportCSV()
        {
            if ((m_ItemDescriberDataSet.Items.GetChanges() != null) || (m_ItemDescriberDataSet.ItemProperty.GetChanges() != null))
            {
                if (MessageBox.Show(this, "Save current data?", "Data changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SaveXML();
                }
            }
            OpenFileDialog openFileDialogXMLFile = new OpenFileDialog
            {
                InitialDirectory = AppDomain.CurrentDomain.BaseDirectory,
                Filter           = "CSV files (*.CSV)|*.CSV",
                DefaultExt       = ".CSV"
            };

            switch (openFileDialogXMLFile.ShowDialog())
            {
            case System.Windows.Forms.DialogResult.OK:
                CSVManagement _csvManagement = new CSVManagement();
                _csvManagement.LoadCSV(m_ItemDescriberDataSet, openFileDialogXMLFile.FileName);
                break;

            default:
                break;
            }
        }
コード例 #2
0
        private void ExportCSV()
        {
            SaveFileDialog saveXMLFileDialog = new SaveFileDialog
            {
                InitialDirectory = AppDomain.CurrentDomain.BaseDirectory,
                Filter           = "CSV files (*.CSV)|*.CSV",
                DefaultExt       = ".CSV"
            };

            switch (saveXMLFileDialog.ShowDialog())
            {
            case System.Windows.Forms.DialogResult.OK:
                CSVManagement myConfig = new CSVManagement();
                myConfig.SaveCSV(m_ItemDescriberDataSet, saveXMLFileDialog.FileName);
                //itemDecriberDataSet1.Items.AcceptChanges();
                //itemDecriberDataSet1.ItemProperty.AcceptChanges();
                break;

            default:
                break;
            }
        }