Beispiel #1
0
        public void CreateFile()
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Title            = "Створити файл";
            dialog.InitialDirectory = repository.Directory;
            dialog.Filter           = "xml файли (*.xml)|*.xml";
            dialog.RestoreDirectory = true;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                fileName = dialog.FileName;
                try
                {
                    dataSet = repository.CreateDataSet();
                    SaveXmlSchema(Path.GetDirectoryName(fileName) + "\\Books.xsd");
                    dataSet.WriteXml(fileName);
                    //dataSet.WriteXml(fileName, XmlWriteMode.WriteSchema);
                    ShowDataSetMembers();
                    bindingSource.DataSource = dataSet;
                    ShowFileName();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message);
                }
            }
        }